;================================================== ;================================================== #include #include $prompt = msgbox(4129, "Warning", "Close all your applications before using this tool") If $prompt = "2" Then exit Dim $hGUI, $hImage, $hGraphic, $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $font, $var1, $var2, $file $var1 = EnvGet("systemdrive"); ;================================================== If Not FileExists(@SystemDir & '\robocopy.exe') Then FileInstall('Robocopy.exe', @SystemDir & '\Robocopy.exe', 0) #include $hGUI = GUICreate("Backup&Restore_v1.0", 320, 300, (@DesktopWidth - 320) / 2, (@DesktopHeight - 300) / 2, $WS_SIZEBOX + $WS_SYSMENU) GUISetState() $font = "Arial Bold" GUISetFont(12, 600, "", $font) GUISetBkColor(0xE0FFFF) ; ; Load PNG image _GDIPlus_StartUp() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\test.png") ; Draw PNG image $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 20, 20) $Button_1 = GUICtrlCreateButton("Backup", 180, 20, 90, 40) $Button_2 = GUICtrlCreateButton("Backuplog", 180, 70, 90, 40) $Button_3 = GUICtrlCreateButton("Restore", 180, 120, 90, 40) $Button_4 = GUICtrlCreateButton("Restorelog", 180, 170, 90, 40) $Button_5 = GUICtrlCreateButton("Quit", 80, 210, 90, 40) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $Button_1 RunWait('robocopy "' & @UserProfileDir & '\Desktop"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Desktop" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Citrix"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Citrix" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Contacts"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Contacts" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Documents"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Documents" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\3D Objects"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\3D Objects" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Downloads"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Downloads" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT //MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Favorites"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Favorites" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Links"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Links" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Music"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Music" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\OneDrive"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\OneDrive" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Pictures"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Pictures" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Saved Games"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Saved Games" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Searches"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Searches" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Videos"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Videos" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL) MsgBox(0, "Job Status", "Backup Done ...", 2) FileDelete($file) Case $msg = $Button_2 OpenFile1() Func OpenFile1() $Path = @DesktopDir & "\varma\Backuplog.txt" ShellExecute($Path) EndFunc ;==>OpenFile Case $msg = $Button_3 $var2 = EnvGet("systemdrive"); $var2 = FileSelectFolder('Select a target path.', ' ', 2) If @error = 1 Then MsgBox(0, "User Cancelled", "User cancelled, Exiting Program", 3) Exit EndIf FileClose($file) FileDelete($file) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Desktop"' & ' "' & @UserProfileDir & '\Desktop" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Citrix"' & ' "' & @UserProfileDir & '\Citrix" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Contacts"' & ' "' & @UserProfileDir & '\Contacts" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Documents"' & ' "' & @UserProfileDir & '\Documents" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\3D Objects"' & ' "' & @UserProfileDir & '\3D Objects" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Downloads"' & ' "' & @UserProfileDir & '\Downloads" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Links"' & ' "' & @UserProfileDir & '\Links" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Music"' & ' "' & @UserProfileDir & '\Music" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\OneDrive"' & ' "' & @UserProfileDir & '\OneDrive" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Pictures"' & ' "' & @UserProfileDir & '\Pictures" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Saved Games"' & ' "' & @UserProfileDir & '\Saved Games" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Searches"' & ' "' & @UserProfileDir & '\Searches" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Videos"' & ' "' & @UserProfileDir & '\Videos" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var2 & "\" & @UserName & '\Favorites"' & ' "' & @UserProfileDir & '\Favorites" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log+:Restorelog.txt', "", @SW_SHOWNORMAL) MsgBox(0, "Job Status", "Restore Done ...", 2) FileDelete($file) Case $msg = $Button_4 OpenFile2() Func OpenFile2() $Path = @DesktopDir & "\varma\Restorelog.txt" ShellExecute($Path) EndFunc ;==>OpenFile Case $msg = $Button_5 Exit Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_ShutDown()