Jump to content

Easy to use office backup utility


failedtocompile
 Share

Recommended Posts

Greetings.

Forgive if my post seems sub standard this is my first time doing this on this forum.

This is one of my first projects with using Autoit. It was designed for ease of use predominately in a Domain environment where users do not have roaming profiles or roaming profiles do not function all that well. it also can be tailored to the stand alone workstation user.

Users tend to get very frustrated having to re setup there office profile multiple mailboxes, half a dozen pst files, signatures, customized views, custom dictionary in Word, stationary settings in word and excel.

This tool backups all possible settings within Word, Excel and Outlook, can also do all the other M$ office products if programed to do so.

please note.. that it will not back up pst files only the link to the pst file i.e. the pathway so it appears in outlook. Standard network domain environment pst files should not be stored locally on client machines.

Requirements:

Windows XP_SP2 - SP3

IE6.5 -7+

Office 2003 (word, excel, outlook, etc etc)

PROFLWIZ.exe file (which comes with install of office 2003 and performs the backup and restore)

OPW11ADM.INI (which comes with 2003 resource pack and contains the config for the PROFLWIZ.exe to use, can be customized)

1x background image .bmp

optional:

1x splash image

1x gif image for animated progress bar ( you could create a scrolling marquee [ProgressOn] )

1x Helpfile (mine was a self created .chm)

#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.0.0
    Author:         ftc
    Date:            08/06/09

    Script Function:
    Easy to use GUI to backup and restore office profile
    Applications: Word, Excel, Outlook.

    Requirements:
    Office 2003 PROFLWIZ.EXE and Office 2003 OPW11ADM.INI. Both are from Office 2003 resource pack.
    1x Background .bmp image
#ce ----------------------------------------------------------------------------

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiToolTip.au3>
#include <file.au3>
#include <IE.au3>

ProcessSetPriority("enter your process name.exe", 0) ;sets process priority
TraySetState(2) ; hides system tray icon
_fileinstall()

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;   My Variables Begin                                                   +
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;$MyHomeShare = EnvGet("HomeShare") ; retrives assigned local computer variable %HomeShare% {can be used if not using specific drive mappings}
$ProcessName1 = "Outlook.exe" ; M$ outlook process
$ProcessName2 = "WinWord.exe" ; M$ Word process
$ProcessName3 = "Excel.exe" ; M$ Excel Process
$Proflwiz = @TempDir & "\PROFLWIZ.exe" ;Location where the PROFLWIZ is stored local on the host machine
$file1 = "H:\Officebkup\Officebkup.ops" ; the location and file name of the back file created
$Logfile = @ScriptDir & "\officeprofiler.log" ; Log file name and location
$helpfileloc = @ScriptDir & "\helpfile\.htm" ; Helpfile name and location
$splashimage = FileGetShortName(@ScriptDir & '\image1.jpg') ; splash image location for when application is launched
$gif = (@TempDir & '\loader.gif') ; motion gif image for both backup and restore functions


;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;   My Functions begin                                                   +
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Func _restore123()
    Local $pheight = 50, $pwidth = 50, $oIE, $GUIActiveX, $gif ; sets the relative size of the motion gif
    $gif = FileGetShortName(@TempDir & '\loader.gif')
    If @error Then Exit
    $oIE = ObjCreate("Shell.Explorer.2")
    $Form3 = GUICreate("Restore in Progress", 285, 98, 452, 349, BitOR($WS_POPUP, $WS_CLIPSIBLINGS), 0)
    GUISetBkColor(0xE0FFFF)
    GUICtrlCreateLabel("Restore In Progress. Please Wait...", 10, 8, 239, 20, $WS_CLIPSIBLINGS)
    GUICtrlSetFont(-1, 10, 800, 0, "Bodoni MT Black")
    $GUIActiveX = GUICtrlCreateObj($oIE, 110, 40, $pwidth, $pheight)
    $oIE.navigate("about:blank")
    While _IEPropertyGet($oIE, "busy")
        Sleep(100)
    WEnd
    $oIE.document.body.background = $gif
    $oIE.document.body.scroll = "no"
    GUISetState()
    Sleep(500)
    Do
    Until ProcessExists("PROFLWIZ.exe") == 0
    GUIDelete($Form3)

EndFunc   ;==>_restore123

Func _bkup123()
    Local $pheight = 50, $pwidth = 50, $oIE, $GUIActiveX, $gif ; sets the relative size of the motion gif
    $gif = FileGetShortName(@Tempdir & '\loader.gif')
    If @error Then Exit
    $oIE = ObjCreate("Shell.Explorer.2")
    $form4 = GUICreate("backup in Progress", 285, 98, 452, 349, BitOR($WS_POPUP, $WS_CLIPSIBLINGS), 0)
    GUISetBkColor(0xE0FFFF)
    GUICtrlCreateLabel("Backup In Progress. Please Wait...", 10, 8, 239, 20, $WS_CLIPSIBLINGS)
    GUICtrlSetFont(-1, 10, 800, 0, "Bodoni MT Black")
    $GUIActiveX = GUICtrlCreateObj($oIE, 110, 40, $pwidth, $pheight)
    $oIE.navigate("about:blank")
    While _IEPropertyGet($oIE, "busy")
        Sleep(100)
    WEnd
    $oIE.document.body.background = $gif
    $oIE.document.body.scroll = "no"
    GUISetState()
    Sleep(500)
    Do
    Until ProcessExists("PROFLWIZ.exe") == 0
    GUIDelete($form4)
EndFunc   ;==>_bkup123

Func _fileinstall() ; installs files to host machine
    FileInstall("", @TempDir & "", 0)
    Sleep(200)
    FileInstall("PROFLWIZ.exe", @TempDir & "\PROFLWIZ.exe", 0)
    Sleep(200)
    FileInstall("OPW11ADM.INI", @TempDir & "\OPW11ADM.INI", 0)
    Sleep(200)
    FileInstall("loader.gif", @TempDir & "\loader.gif", 0)
EndFunc   ;==>_fileinstall


Func _bkup() ; Backup and logfile entry creation
    Run('"' & $Proflwiz & '" /q /s "' & $file1 & '"')
    FileWriteLine($Logfile, "Date & Time::" & " " & @MDAY & "/" & @MON & " " & @HOUR & ":" & @MIN & " " & "ComputerName::" _
             & " " & @ComputerName & " " & "UserName::" & " " & @UserName & ' ' & '[Backup]')
    Do
    Until ProcessExists("PROFLWIZ.EXE")
    _bkup123()
EndFunc   ;==>_bkup

Func _restore() ;Restore and logfile entry creation
    Run('"' & $Proflwiz & '" /d /q /r "' & $file1 & '"')
    FileWriteLine($Logfile, "Date & Time::" & " " & @MDAY & "/" & @MON & " " & @HOUR & ":" & @MIN & " " & "ComputerName::" _
             & " " & @ComputerName & " " & "UserName::" & " " & @UserName & ' ' & '[Restore]')
    Do
    Until ProcessExists("PROFLWIZ.EXE")
    _restore123()
EndFunc   ;==>_restore

Func _Selfhelp() ; link to self help
    ShellExecute("http:///index.php?id=777")
    FileWriteLine($Logfile, "Date & Time::" & " " & @MDAY & "/" & @MON & " " & @HOUR & ":" & @MIN & " " & "ComputerName::" _
             & " " & @ComputerName & " " & "UserName::" & " " & @UserName & ' ' & '[Self Help]')
EndFunc   ;==>_Selfhelp

Func _helpfile() ; application based help file
    Run(@ComSpec & ' /c ' & 'hh.exe' & ' ' & '-800' & ' ' & $helpfileloc, @SystemDir, @SW_HIDE)
    FileWriteLine($Logfile, "Date & Time::" & " " & @MDAY & "/" & @MON & " " & @HOUR & ":" & @MIN & " " & "ComputerName::" _
             & " " & @ComputerName & " " & "UserName::" & " " & @UserName & ' ' & '[How to use this]')
EndFunc   ;==>_helpfile

; The GUI
$Form1 = GUICreate("", 401, 230, 452, 349)
$MenuItem1 = GUICtrlCreateMenu("Menu")
$MenuItem2 = GUICtrlCreateMenu("Help")
$helpmenu = GUICtrlCreateMenuItem("How to use this software", $MenuItem2)
$feedback = GUICtrlCreateMenuItem("Send Feedback", $MenuItem1)
$Bkgrnd = GUICtrlCreatePic(@TempDir & "\", -3, -1, 410, 220, $WS_CLIPSIBLINGS)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 2500, "Long", 0x80000);fade-in effect
$Btn_bkup = GUICtrlCreateButton("$Btn_bkup", 9, 168, 82, 41, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))
GUICtrlSetCursor(-1, 0)
$Btn_restore = GUICtrlCreateButton("$Btn_restore", 315, 168, 73, 41, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))
GUICtrlSetCursor(-1, 0)
$Btn_exit = GUICtrlCreateButton("$Btn_exit", 333, 0, 82, 37, BitOR($WS_CLIPSIBLINGS, $BS_FLAT))
GUICtrlSetCursor(-1, 0)
$Btn_1 = GUICtrlCreateButton("$Btn_1", 12, 58, 97, 33, BitOR($WS_CLIPSIBLINGS, $BS_FLAT)) ;self help training
GUICtrlSetCursor(-1, 0)
$Btn_2 = GUICtrlCreateButton("Btn_2", 12, 108, 97, 36, BitOR($WS_CLIPSIBLINGS, $BS_FLAT)) ;send email to helpdesk
GUICtrlSetCursor(-1, 0)

GUICtrlSetTip($Btn_restore, " Will Restore you office profile" & @LF & _
        " On to this computer")

GUICtrlSetTip($Btn_bkup, " Will backup your current office profile" & @LF & _
        "To later be restored on another computer")

GUICtrlSetTip($Btn_exit, " Exit ")

GUICtrlSetTip($Btn_1, " Link online training" & @LF & _
        "http:///index.php?id=777")

GUICtrlSetTip($Btn_2, "Send an e-mail to helpdesk@")
GUISetState(@SW_SHOW)

;Check for a vaild drive mapping if not exisit then displays error and terminates utility, if valid Drive then displays splashscreen
$Drivemap = DriveGetType("Z:\")
If Not @error Then
    SplashImageOn("", $splashimage, 404, 300, 452, 349, 17)
    Sleep(4000)
    SplashOff()

ElseIf @error Then
    SplashTextOn("", "No Vaild Z: Drive" & @CRLF & "This Utility will not work correctly, Please contact The IT department" & @CRLF & "" & @CRLF & _
            "and Report this error. ", 280, 185, 452, 349, 1, "", 17)
    Sleep(5000)
    SplashOff()
    Exit
EndIf


While 1
    Sleep(30)
    Switch GUIGetMsg()

        Case $Btn_bkup
            If ProcessExists($ProcessName1) Then ; Checking for running process
                MsgBox(0, "", "Outlook" & "   Is Running please close it down before using this utility.")
            ElseIf ProcessExists($ProcessName2) Then ; Checking for running process
                MsgBox(0, "", "Word" & "   Is Running please close it down before using this utility.")
            ElseIf ProcessExists($ProcessName3) Then ; Checking for running process
                MsgBox(0, "", "Excel" & "   Is Running please close it down before using this utility.")
            ElseIf FileExists($file1) Then
                $Filemsgbox = MsgBox(0x1, "Backup Exists", "An existing backup has been detected, Press cancel to abort or okay to override", 13)
                If $Filemsgbox = 1 Then _bkup()
            Else
                _bkup()
            EndIf

        Case $Btn_restore
            If ProcessExists($ProcessName1) Then ; Checking for running process
                MsgBox(0, "", "Outlook" & "   Is Running please close it down before using this utility.")
            ElseIf ProcessExists($ProcessName2) Then ; Checking for running process
                MsgBox(0, "", "Word" & "   Is Running please close it down before using this utility.")
            ElseIf ProcessExists($ProcessName3) Then ; Checking for running process
                MsgBox(0, "", "Excel" & "   Is Running please close it down before using this utility.")

            ElseIf Not FileExists($file1) Then
                $Filemsgbox2 = MsgBox(0, "No Backup Exists", "No previouse backup was detected, Unable to restore", 13)
            Else
                _restore()
            EndIf

        Case $helpmenu
            _helpfile()

        Case $Btn_1
            _selfhelp()

        Case $feedback
            ShellExecute("Mailto:ftc@ftc.com?Subject=Feedback on Office profiler&Body=All your comments are appreciated!%0AThankyou")

        Case $Btn_2
            ShellExecute('Mailto:helpdesk@')

        Case $Btn_exit
            MsgBox(0, 'Thankyou', 'Thankyou for using ' & @LF & '' & @LF & 'Office Profiler' & @LF & '' & @LF & 'Enjoy Your day')
            Exit
    EndSwitch
WEnd

I would like to say thanks to the Autoit Community and google search :) who have helped me along my Autoit path ;)

As mentioned before this is my first project in Autoit so no doubt the code could be tweaked. If you have any comments or suggestion please post them. I myself think this would be an invaluable tool for large corporate networks to reduce calls to Helpdesk and or

show your clients that you care B)

ftc

If you require a vbs script to deploy a shortcut to all users desktop via gp, this may help you.

' ###########################
' #     Created By ftc      #
' ###########################

Set objWSHShell = WScript.CreateObject("Wscript.Shell")
strDesktop = objWSHShell.SpecialFolders("Desktop")
strShortcutName = "Office Profiler"
strShortcutPath = "\\server\1\2\3\OFFICE~1\Install\~1.EXE"

Set objShortcut = objWSHShell.CreateShortcut(strDesktop & "\" + strShortcutName & ".lnk")
objshortcut.Description = "Office Profiler"
objShortcut.TargetPath=strShortcutPath
objShortcut.Save

'created a small app that gets a files "shortfilename" which is placed in strShortcutPath which should create the shortcut quicker
Edited by failedtocompile
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...