; ; Robust File Copy Utility $Version = FileGetVersion (@ScriptFullPath, 'ProductVersion') #Pragma Compile (FileDescription, 'Robust File Copy Utility') #Pragma Compile (FileVersion, '7.23.07.19') #Pragma Compile (ProductName, 'RoboCopy GUI') #Pragma Compile (ProductVersion, '7.23.07') #Pragma Compile (CompanyName, 'Microsoft Corporation') #Pragma Compile (LegalTrademarks, 'RoboCopy® is a registered trademark of Microsoft Corporation.') #Pragma Compile (LegalCopyright, 'RoboCopy Copyright © Microsoft Corporation 1995-2023. All rights reserved.') #Region AutoIt3Wrapper directives section #AutoIt3Wrapper_Icon=DATA\RoboCopy.ico #AutoIt3Wrapper_OutFile=RoboCopyX86.exe #AutoIt3Wrapper_OutFile_X64=RoboCopyX64.exe #AutoIt3Wrapper_OutFile_Type=exe #AutoIt3Wrapper_Change2CUI=N #AutoIt3Wrapper_UseX64=Y #AutoIt3Wrapper_Compile_Both=Y #AutoIt3Wrapper_UseUpx=N #AutoIt3Wrapper_Compression=0 ; #AutoIt3Wrapper_UPX_Parameters=--ultra-brute #AutoIt3Wrapper_Res_RequestedExecutionLevel=asInvoker #AutoIt3Wrapper_Res_Description=Robust File Copy Utility #AutoIt3Wrapper_Res_Fileversion=7.23.07.19 #AutoIt3Wrapper_Res_Field=Product name|RoboCopy GUI #AutoIt3Wrapper_Res_Field=Product version|7.23.07 #AutoIt3Wrapper_Res_Field=Company name|Microsoft Corporation #AutoIt3Wrapper_Res_Comment=RoboCopy® is a registered trademark of Microsoft Corporation. #AutoIt3Wrapper_Res_LegalCopyright=RoboCopy Copyright © Microsoft Corporation 1995-2023. All rights reserved. #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Allow_Decompile=N #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=N #AutoIt3Wrapper_Run_AU3Check=N #AutoIt3Wrapper_Run_Obfuscator=N #EndRegion ; Language: Language Neutral ; Platform: Win32bit/64bit ; Author: Microsoft Corporation ; #NoTrayIcon AutoItSetOption ('TrayIconHide', 1) AutoItSetOption ('TrayAutoPause', 0) AutoItSetOption ('TrayMenuMode', 1) AutoItSetOption ('TrayOnEventMode', 1) AutoItSetOption ('GUICloseOnESC', 0) AutoItSetOption ('GUIDataSeparatorChar', '|') #include #include #include #include #include #include #include #include #include #include Global $SetTimeFormat = 0x1032, $SetMeasureUnits = StringSplit ('KB|MB|GB', '|') $GUIRoboCopy = GUICreate ('RoboCopy - Robust File Copy Utility', 750, 530, -1, -1, -1, $WS_EX_ACCEPTFILES) $MenuJob = GUICtrlCreateMenu ('Jobs') $MenuJobSave = GUICtrlCreateMenuItem ('Save Job', $MenuJob, 0, 0) $MenuJobLoad = GUICtrlCreateMenuItem ('Load Job', $MenuJob, 1, 0) $MenuProcessJobs = GUICtrlCreateMenuItem ('Process Jobs', $MenuJob, 2, 0) $MenuJobClear = GUICtrlCreateMenuItem ('Clear Job', $MenuJob, 3, 0) $MenuPreset = GUICtrlCreateMenu ('Presets') $MenuPresetCopyOnce = GUICtrlCreateMenuItem ('Copy and Exit', $MenuPreset, 0, 0) $MenuPresetCopy = GUICtrlCreateMenuItem ('Copy and keep Monitoring', $MenuPreset, 1, 0) $MenuPresetMirror = GUICtrlCreateMenuItem ('Mirror / Replication', $MenuPreset, 2, 0) $MenuHelp = GUICtrlCreateMenu ('Help') $MenuHelpRC = GUICtrlCreateMenuItem ('RoboCopy Help', $MenuHelp, 0, 0) $MenuHelpGUI = GUICtrlCreateMenuItem ('RoboCopy GUI Help', $MenuHelp, 1, 0) GUICtrlCreateGroup ('Path and File Options:', 10, 5, 415, 105) GUICtrlSetState (-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel ('Source directory:', 20, 30, 110, 15) $SrcDir = GUICtrlCreateInput ('', 130, 27, 255, 20) $BrowseSrcDir = GUICtrlCreateButton ('...', 392, 26, 25, 22) GUICtrlSetTip ($BrowseSrcDir, 'Browse Source Directory') GUICtrlCreateLabel ('Destination directory:', 20, 55, 110, 15) $DestDir = GUICtrlCreateInput ('', 130, 52, 255, 20) $BrowseDestDir = GUICtrlCreateButton ('...', 392, 51, 25, 22) GUICtrlSetTip ($BrowseDestDir, 'Browse Destination Directory') GUICtrlCreateLabel ('Files to copy:', 20, 80, 110, 15) $SrcFiles = GUICtrlCreateInput ('*.*', 130, 77, 255, 20) GUICtrlSetTip ($SrcFiles, 'Wildcards "*" and "?" are supported' & @CRLF & 'Use semicolon ";" to separate files') GUICtrlCreateGroup ('Copy Options:', 10, 115, 415, 205) GUICtrlSetState (-1, $GUI_DROPACCEPTED) $RestartableMode = GUICtrlCreateCheckbox ('Copy files in restartable mode', 20, 139, 175, 15) GUICtrlSetTip ($RestartableMode, 'May negatively reflect on the speed of the copy process.') $CopySubDir = GUICtrlCreateCheckbox ('Copy subdirectories', 20, 164, 115, 15) GUICtrlSetState ($CopySubDir, $GUI_CHECKED) $CopySubDirOption = GUICtrlCreateCombo ('Copy empty directories', 145, 161, 150, 20, $CBS_DROPDOWNLIST + $CBS_AUTOHSCROLL + $WS_VSCROLL) GUICtrlSetData ($CopySubDirOption, 'Discard empty directories|Copy top "n" levels') GUICtrlSetState ($CopySubDirOption, $GUI_DISABLE) $nLevels = GUICtrlCreateInput ('1', 305, 162, 40, 20, $ES_CENTER + $ES_NUMBER + $ES_READONLY) $_nLevels = GUICtrlCreateUpdown ($nLevels, $UDS_ALIGNRIGHT + $UDS_ARROWKEYS + $UDS_NOTHOUSANDS + $UDS_WRAP) GUICtrlSetLimit (-1, 99, 1) GUICtrlSetState ($nLevels, $GUI_HIDE) GUICtrlSetState ($_nLevels, $GUI_HIDE) GUICtrlCreateLabel ('Copy:', 20, 190, 30, 15) $CopyS = GUICtrlCreateCheckbox ('Security info', 60, 189, 85, 15) $CopyO = GUICtrlCreateCheckbox ('Owner info', 170, 189, 85, 15) $CopyU = GUICtrlCreateCheckbox ('Auditing info', 280, 189, 85, 15) If NOT IsAdmin () Then GUICtrlSetState ($CopyS, $GUI_DISABLE) GUICtrlSetState ($CopyO, $GUI_DISABLE) GUICtrlSetState ($CopyU, $GUI_DISABLE) EndIf $Purge = GUICtrlCreateCheckbox ('Delete destination files and directories that no longer exist in source', 20, 214, 350, 15) $Move = GUICtrlCreateCheckbox ('Move files and directories', 20, 239, 150, 15) GUICtrlCreateLabel ('Remove attributes:', 20, 265, 100, 15) $aRemoveA = GUICtrlCreateCheckbox ('Archive', 120, 264, 60, 15) $aRemoveR = GUICtrlCreateCheckbox ('Read only', 195, 264, 75, 15) $aRemoveH = GUICtrlCreateCheckbox ('Hidden', 280, 264, 60, 15) $aRemoveS = GUICtrlCreateCheckbox ('System', 350, 264, 60, 15) GUICtrlCreateLabel ('Add attributes:', 20, 290, 100, 15) $aAddA = GUICtrlCreateCheckbox ('Archive', 120, 289, 60, 15) $aAddR = GUICtrlCreateCheckbox ('Read only', 195, 289, 75, 15) $aAddH = GUICtrlCreateCheckbox ('Hidden', 280, 289, 60, 15) $aAddS = GUICtrlCreateCheckbox ('System', 350, 289, 60, 15) GUICtrlCreateGroup ('Monitoring, Time and Retry Options:', 435, 5, 305, 230) GUICtrlSetState (-1, $GUI_DROPACCEPTED) $MonitorChange = GUICtrlCreateCheckbox ('Monitor source every', 445, 29, 125, 15) $nChange = GUICtrlCreateInput ('1', 575, 27, 48, 20, $ES_CENTER + $ES_NUMBER + $ES_READONLY) $_nChange = GUICtrlCreateUpdown ($nChange, $UDS_ALIGNRIGHT + $UDS_ARROWKEYS + $UDS_NOTHOUSANDS + $UDS_WRAP) GUICtrlSetLimit (-1, 999, 1) GUICtrlSetState ($_nChange, $GUI_DISABLE) $_MonitorChange = GUICtrlCreateLabel ('changes', 628, 30, 50, 15, $SS_LEFTNOWORDWRAP + $SS_NOTIFY) $MonitorTime = GUICtrlCreateCheckbox ('Monitor source every', 445, 54, 125, 15) $nTime = GUICtrlCreateInput ('1', 575, 52, 48, 20, $ES_CENTER + $ES_NUMBER + $ES_READONLY) $_nTime = GUICtrlCreateUpdown ($nTime, $UDS_ALIGNRIGHT + $UDS_ARROWKEYS + $UDS_NOTHOUSANDS + $UDS_WRAP) GUICtrlSetLimit (-1, 720, 1) GUICtrlSetState ($_nTime, $GUI_DISABLE) $_MonitorTime = GUICtrlCreateLabel ('minutes', 628, 55, 50, 15, $SS_LEFTNOWORDWRAP + $SS_NOTIFY) $RunTime = GUICtrlCreateCheckbox ('Specify run hours from', 445, 79, 130, 15) $StartTime = GUICtrlCreateDate ('', 575, 77, 55, 20, $DTS_TIMEFORMAT) GUICtrlSendMsg ($StartTime, $SetTimeFormat, 0, 'HH:mm') $DefaultDate = @YEAR & '/' & @MON & '/' & @MDAY & ' ' $DefaultTime = '22:00' GUICtrlSetData ($StartTime, $DefaultDate & $DefaultTime) GUICtrlSetState ($StartTime, $GUI_DISABLE) $_RunTime = GUICtrlCreateLabel ('to', 635, 80, 20, 15, $SS_CENTER + $SS_NOTIFY) $EndTime = GUICtrlCreateDate ('', 660, 77, 55, 20, $DTS_TIMEFORMAT) GUICtrlSendMsg ($EndTime, $SetTimeFormat, 0, 'HH:mm') $DefaultDate = @YEAR & '/' & @MON & '/' & @MDAY & ' ' $DefaultTime = '06:00' GUICtrlSetData ($EndTime, $DefaultDate & $DefaultTime) GUICtrlSetState ($EndTime, $GUI_DISABLE) $RunTimePF = GUICtrlCreateCheckbox ('Apply run hours on a "per File" (not on "per Pass") basis', 445, 104, 290, 15) GUICtrlSetState ($RunTimePF, $GUI_DISABLE) GUICtrlSetTip ($RunTimePF, 'Run hours check will be performed before' & @CRLF & 'each individual file copy is started') $IPG = GUICtrlCreateCheckbox ('Inter-Packet gape', 445, 129, 110, 15) $nIPG = GUICtrlCreateInput ('1', 560, 127, 48, 20, $ES_CENTER + $ES_NUMBER + $ES_READONLY) $_nIPG = GUICtrlCreateUpdown ($nIPG, $UDS_ALIGNRIGHT + $UDS_ARROWKEYS + $UDS_NOTHOUSANDS + $UDS_WRAP) GUICtrlSetLimit (-1, 50, 1) GUICtrlSetState ($_nIPG, $GUI_DISABLE) GUICtrlSetTip ($IPG, 'Gape between each 64k chunk of file data transferred') GUICtrlSetTip ($nIPG, 'Latency [ms] = 500 x (Ba - Bd) / (Ba x Bd)' & @CRLF & 'Ba - Available Bandwith [Mbps]' & @CRLF & 'Bd - Desired Bandwith [Mbps]') GUICtrlCreateLabel ('[ ms ]', 613, 130, 25, 15, $SS_LEFTNOWORDWRAP + $SS_NOTIFY) $Retry = GUICtrlCreateCheckbox ('Retry attempts', 445, 154, 95, 15) $nRetry = GUICtrlCreateInput ('3', 560, 152, 48, 20, $ES_CENTER + $ES_NUMBER + $ES_READONLY) $_nRetry = GUICtrlCreateUpdown ($nRetry, $UDS_ALIGNRIGHT + $UDS_ARROWKEYS + $UDS_NOTHOUSANDS + $UDS_WRAP) GUICtrlSetLimit (-1, 999, 1) GUICtrlSetState ($_nRetry, $GUI_DISABLE) $RetryTime = GUICtrlCreateCheckbox ('Retry wait time', 445, 179, 95, 15) $nRetryTime = GUICtrlCreateInput ('5', 560, 177, 48, 20, $ES_CENTER + $ES_NUMBER + $ES_READONLY) $_nRetryTime = GUICtrlCreateUpdown ($nRetryTime, $UDS_ALIGNRIGHT + $UDS_ARROWKEYS + $UDS_NOTHOUSANDS + $UDS_WRAP) GUICtrlSetLimit (-1, 300, 5) GUICtrlSetState ($_nRetryTime, $GUI_DISABLE) GUICtrlCreateLabel ('[ s ]', 613, 180, 25, 15, $SS_LEFTNOWORDWRAP + $SS_NOTIFY) $RetryNet = GUICtrlCreateCheckbox ('Retry on "Network path error"', 445, 204, 175, 15) GUICtrlSetTip ($RetryNet, 'Wait until network share becomes available') GUICtrlCreateGroup ('Logging / Display Options:', 435, 240, 305, 80) GUICtrlSetState (-1, $GUI_DROPACCEPTED) $LOGTimeStamps = GUICtrlCreateCheckbox ('Include time stamps', 445, 264, 125, 15) $LOGFullPathnames = GUICtrlCreateCheckbox ('Include full pathnames', 570, 264, 135, 15) $LOGFileSizes = GUICtrlCreateCheckbox ('Exclude file sizes', 445, 289, 125, 15) $LOGeta = GUICtrlCreateCheckbox ('Show estimated time of arrival', 570, 289, 165, 15) GUICtrlCreateGroup ('File Selection Options:', 10, 325, 730, 155) GUICtrlSetState (-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel ('Exclude files:', 20, 350, 70, 15) $eXcludeFiles = GUICtrlCreateInput ('', 90, 347, 255, 20) GUICtrlSetTip ($eXcludeFiles, 'Input path or file name' & @CRLF & 'Wildcards "*" and "?" are supported' & @CRLF & 'Use semicolon ";" to separate entries') GUICtrlCreateLabel ('Exclude directories:', 375, 350, 100, 15) $eXcludeDirs = GUICtrlCreateInput ('', 475, 347, 255, 20) GUICtrlSetTip ($eXcludeDirs, 'Input path or directory name' & @CRLF & 'Wildcards "*" and "?" are supported' & @CRLF & 'Use semicolon ";" to separate entries') GUICtrlCreateLabel ('Exclude:', 20, 375, 45, 15) $eXcludeOld = GUICtrlCreateCheckbox ('Older files', 90, 374, 85, 15) GUICtrlSetTip ($eXcludeOld, 'Newer files in the destination directory will not be overwritten') $eXcludeC = GUICtrlCreateCheckbox ('Compressed files', 180, 374, 115, 15) $eXcludeE = GUICtrlCreateCheckbox ('Encrypted files', 300, 374, 110, 15) GUICtrlSetState ($eXcludeE, $GUI_CHECKED) $eXcludeT = GUICtrlCreateCheckbox ('Temporary files', 415, 374, 110, 15) $eXcludeO = GUICtrlCreateCheckbox ('Offline files', 530, 374, 90, 15) $eXcludeJ = GUICtrlCreateCheckbox ('Junction points', 625, 374, 105, 15) GUICtrlSetState ($eXcludeJ, $GUI_CHECKED) $CopyArchive = GUICtrlCreateCheckbox ('Only copy files with the Archive attribute', 20, 399, 210, 15) GUICtrlCreateLabel ('(', 230, 400, 5, 15, $SS_LEFTNOWORDWRAP + $SS_NOTIFY) $ResetArchive = GUICtrlCreateCheckbox ('reset the Archive attribute', 240, 399, 145, 15) GUICtrlSetState ($ResetArchive, $GUI_DISABLE) GUICtrlCreateLabel (')', 385, 400, 5, 15, $SS_LEFTNOWORDWRAP + $SS_NOTIFY) $minSize = GUICtrlCreateCheckbox ('minimum file size', 20, 424, 115, 15) $minValue = GUICtrlCreateInput ('', 135, 422, 30, 21, $ES_CENTER + $ES_NUMBER) GUICtrlSetState ($minValue, $GUI_DISABLE) $minMeasure = GUICtrlCreateCombo ('', 166, 422, 40, 20, $CBS_DROPDOWNLIST + $CBS_AUTOHSCROLL + $WS_VSCROLL) For $i = 1 to $SetMeasureUnits[0] GUICtrlSetData ($minMeasure, $SetMeasureUnits[$i], $SetMeasureUnits[1]) Next GUICtrlSetState ($minMeasure, $GUI_DISABLE) $MAXSize = GUICtrlCreateCheckbox ('MAXIMUM file size', 20, 449, 115, 15) $MAXValue = GUICtrlCreateInput ('', 135, 447, 30, 21, $ES_CENTER + $ES_NUMBER) GUICtrlSetState ($MAXValue, $GUI_DISABLE) $MAXMeasure = GUICtrlCreateCombo ('', 166, 447, 40, 20, $CBS_DROPDOWNLIST + $CBS_AUTOHSCROLL + $WS_VSCROLL) For $i = 1 to $SetMeasureUnits[0] GUICtrlSetData ($MAXMeasure, $SetMeasureUnits[$i], $SetMeasureUnits[1]) Next GUICtrlSetState ($MAXMeasure, $GUI_DISABLE) $minAge = GUICtrlCreateCheckbox ('Exclude files older than', 240, 424, 140, 15) $minAgeDate = GUICtrlCreateDate (@YEAR & '/' & @MON & '/' & @MDAY, 385, 422, 80, 20) GUICtrlSendMsg ($minAgeDate, $SetTimeFormat, 0, 'dd.MM.yyyy.') GUICtrlSetData ($minAgeDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($minAgeDate, $GUI_DISABLE) $MAXAge = GUICtrlCreateCheckbox ('Exclude files newer than', 240, 449, 140, 15) $MAXAgeDate = GUICtrlCreateDate (@YEAR & '/' & @MON & '/' & @MDAY, 385, 447, 80, 20) GUICtrlSendMsg ($MAXAgeDate, $SetTimeFormat, 0, 'dd.MM.yyyy.') GUICtrlSetData ($MAXAgeDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($MAXAgeDate, $GUI_DISABLE) $MAXAccess = GUICtrlCreateCheckbox ('Exclude files unused since', 495, 424, 150, 15) $MAXAccessDate = GUICtrlCreateDate (@YEAR & '/' & @MON & '/' & @MDAY, 650, 422, 80, 20) GUICtrlSendMsg ($MAXAccessDate, $SetTimeFormat, 0, 'dd.MM.yyyy.') GUICtrlSetData ($MAXAccessDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($MAXAccessDate, $GUI_DISABLE) $minAccess = GUICtrlCreateCheckbox ('Exclude files used since', 495, 449, 150, 15) $minAccessDate = GUICtrlCreateDate (@YEAR & '/' & @MON & '/' & @MDAY, 650, 447, 80, 20) GUICtrlSendMsg ($minAccessDate, $SetTimeFormat, 0, 'dd.MM.yyyy.') GUICtrlSetData ($minAccessDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($minAccessDate, $GUI_DISABLE) $LinkView = GUICtrlCreateLabel ('Commands', 10, 487, 60, 20) GUICtrlSetColor ($LinkView, 0x0000ff) GUICtrlSetFont ($LinkView, 8.5, 400, 4) GUICtrlSetCursor ($LinkView, 0) GUICtrlSetTip ($LinkView, 'View RoboCopy command line') $jobLOG = GUICtrlCreateCheckbox ('Logging', 460, 487, 65, 15, $BS_AUTO3STATE) GUICtrlSetState ($jobLOG, $GUI_INDETERMINATE) GUICtrlSetTip ($jobLOG, 'Offer to save LOG') $jobState = GUICtrlCreateCheckbox ('Silent', 530, 487, 50, 15, $BS_AUTO3STATE) GUICtrlSetState ($jobState, $GUI_INDETERMINATE) GUICtrlSetTip ($jobState, 'Terse output') $ButtonStart = GUICtrlCreateButton ('Start', 585, 484, 75, 22) If IsAdmin () Then fButtonSetShield($ButtonStart, True) $ButtonExit = GUICtrlCreateButton ('Close', 665, 484, 75, 22) GUICtrlSetState ($ButtonExit, $GUI_DEFBUTTON) GUICtrlSetState ($ButtonExit, $GUI_FOCUS) TraySetClick (0) TraySetOnEvent ($TRAY_EVENT_PRIMARYDOWN, 'fGUIOpen') Dim $T_CopySubDir = 0, $T_CopySubDirOption = 0 Dim $T_RestartableMode = 0, $T_Purge = 0, $T_Move = 0 Dim $T_aAttribA = 0, $T_aAttribR = 0, $T_aAttribH = 0, $T_aAttribS = 0, $i_aRemove = 0 Dim $T_bAttribA = 0, $T_bAttribR = 0, $T_bAttribH = 0, $T_bAttribS = 0, $i_aAdd = 0 Dim $T_RestartableMode = 0, $T_Purge = 0, $T_Move = 0 Dim $T_MonitorChange = 0, $T_MonitorTime = 0, $T_RunTime = 0, $T_IPG = 0, $T_Retry = 0, $T_RetryTime = 0, $T_CopyArchive = 0 Dim $T_minSize = 0, $T_MAXSize = 0, $T_minAge = 0, $T_MAXAge = 0, $T_MAXAccess = 0, $T_minAccess = 0 Dim $T_JobLOG = -1, $T_JobState = -1, $T_Idling = '', $T_Copying = 0 Dim $ProcessStop = -1, $RoboCopyPID = 0, $TrayTip = 0 Dim $PullTime = 1000*1, $T_PullStart = TimerInit (), $T_PullEnd = TimerDiff ($T_PullStart) Dim $TempFileName = StringRegExpReplace(Hex (@HOUR & @MIN & @SEC & @MSEC & @AutoItPID), '^0*', '') Dim $T_JobDropped = False, $T_JobFile = '', $T_JobLoad = False, $T_JobLoadFile = '', $T_JobStart = False, $T_JobExit = False For $i = 1 To $CmdLine[0] If ($CmdLine[$i] = '/?' OR $CmdLine[$i] = '-?' OR $CmdLine[$i] = '?') AND fDisplayHelp() Then Exit If StringLower (StringLeft ($CmdLine[$i], 5)) <> '/job:' AND StringLower (StringRight ($CmdLine[$i], 4)) = '.gjb' AND FileExists ($CmdLine[$i]) Then IniReadSection ($CmdLine[$i], 'PATH_FILE') If @error Then ContinueLoop If NOT $T_JobDropped Then $T_Answer = MsgBox (262691, 'RoboCopy', 'Would you like to automatically "Start" the Jobs?', 30) Switch $T_Answer Case 2 Exit Case 6 ShellExecute (@ScriptFullPath, '/job:"' & $CmdLine[$i] & '" /start', @ScriptDir, 'open') Case 7 ShellExecute (@ScriptFullPath, '/job:"' & $CmdLine[$i] & '"', @ScriptDir, 'open') EndSwitch $T_JobDropped = True EndIf If StringLower (StringLeft ($CmdLine[$i], 5)) = '/job:' AND StringLower (StringRight ($CmdLine[$i], 4)) = '.gjb' Then If FileExists (StringTrimLeft ($CmdLine[$i], 5)) Then Dim $T_JobLoadFile = StringTrimLeft ($CmdLine[$i], 5), $T_JobLoad = True EndIf If StringLower ($CmdLine[$i]) = '/start' Then Dim $T_JobStart = True If StringLower ($CmdLine[$i]) = '/exit' Then Dim $T_JobExit = True Next If $T_JobDropped Then Exit If NOT $T_JobLoad Then Dim $T_JobStart = False, $T_JobExit = False fLoadJobs(@ScriptDir) EndIf GUISetState (@SW_SHOW, $GUIRoboCopy) While 'RoboCopy' $GUIState = GUIGetMsg () Select Case GUICtrlRead ($RestartableMode) = $GUI_CHECKED AND $T_RestartableMode = 0 GUICtrlSetState ($Move, $GUI_DISABLE) Dim $T_RestartableMode = 1 Case GUICtrlRead ($RestartableMode) = $GUI_UNCHECKED AND $T_RestartableMode = 1 If $T_Purge = 0 Then GUICtrlSetState ($Move, $GUI_ENABLE) Dim $T_RestartableMode = 0 Case GUICtrlRead ($Purge) = $GUI_CHECKED AND $T_Purge = 0 GUICtrlSetState ($Move, $GUI_DISABLE) $T_Purge = 1 Case GUICtrlRead ($Purge) = $GUI_UNCHECKED AND $T_Purge = 1 If $T_RestartableMode = 0 Then GUICtrlSetState ($Move, $GUI_ENABLE) $T_Purge = 0 Case GUICtrlRead ($Move) = $GUI_CHECKED AND $T_Move = 0 GUICtrlSetState ($RestartableMode, $GUI_DISABLE) GUICtrlSetState ($Purge, $GUI_DISABLE) $T_Move = 1 Case GUICtrlRead ($Move) = $GUI_UNCHECKED AND $T_Move = 1 GUICtrlSetState ($RestartableMode, $GUI_ENABLE) GUICtrlSetState ($Purge, $GUI_ENABLE) $T_Move = 0 EndSelect Select Case GUICtrlRead ($CopySubDir) = $GUI_CHECKED AND $T_CopySubDir = 0 GUICtrlSetState ($CopySubDirOption, $GUI_ENABLE) $T_CopySubDir = 1 Case GUICtrlRead ($CopySubDir) = $GUI_UNCHECKED AND $T_CopySubDir = 1 GUICtrlSetData ($CopySubDirOption, 'Copy empty directories', 'Copy empty directories') GUICtrlSetState ($CopySubDirOption, $GUI_DISABLE) $T_CopySubDir = 0 EndSelect Select Case GUICtrlRead ($CopySubDirOption) = 'Copy top "n" levels' AND $T_CopySubDirOption = 0 GUICtrlSetState ($nLevels, $GUI_SHOW) GUICtrlSetState ($_nLevels, $GUI_SHOW) $T_CopySubDirOption = 1 Case GUICtrlRead ($CopySubDirOption) <> 'Copy top "n" levels' AND $T_CopySubDirOption = 1 GUICtrlSetState ($nLevels, $GUI_HIDE) GUICtrlSetState ($_nLevels, $GUI_HIDE) $T_CopySubDirOption = 0 EndSelect Select Case GUICtrlRead ($aRemoveA) = $GUI_CHECKED AND $T_aAttribA = 0 GUICtrlSetState ($aAddA, $GUI_DISABLE) $i_aRemove += 1 $T_aAttribA = 1 Case GUICtrlRead ($aRemoveA) = $GUI_UNCHECKED AND $T_aAttribA = 1 GUICtrlSetState ($aAddA, $GUI_ENABLE) $i_aRemove -= 1 $T_aAttribA = 0 Case GUICtrlRead ($aAddA) = $GUI_CHECKED AND $T_bAttribA = 0 GUICtrlSetState ($aRemoveA, $GUI_DISABLE) $i_aAdd += 1 $T_bAttribA = 1 Case GUICtrlRead ($aAddA) = $GUI_UNCHECKED AND $T_bAttribA = 1 GUICtrlSetState ($aRemoveA, $GUI_ENABLE) $i_aAdd -= 1 $T_bAttribA = 0 EndSelect Select Case GUICtrlRead ($aRemoveR) = $GUI_CHECKED AND $T_aAttribR = 0 GUICtrlSetState ($aAddR, $GUI_DISABLE) $i_aRemove += 1 $T_aAttribR = 1 Case GUICtrlRead ($aRemoveR) = $GUI_UNCHECKED AND $T_aAttribR = 1 GUICtrlSetState ($aAddR, $GUI_ENABLE) $i_aRemove -= 1 $T_aAttribR = 0 Case GUICtrlRead ($aAddR) = $GUI_CHECKED AND $T_bAttribR = 0 GUICtrlSetState ($aRemoveR, $GUI_DISABLE) $i_aAdd += 1 $T_bAttribR = 1 Case GUICtrlRead ($aAddR) = $GUI_UNCHECKED AND $T_bAttribR = 1 GUICtrlSetState ($aRemoveR, $GUI_ENABLE) $i_aAdd -= 1 $T_bAttribR = 0 EndSelect Select Case GUICtrlRead ($aRemoveH) = $GUI_CHECKED AND $T_aAttribH = 0 GUICtrlSetState ($aAddH, $GUI_DISABLE) $i_aRemove += 1 $T_aAttribH = 1 Case GUICtrlRead ($aRemoveH) = $GUI_UNCHECKED AND $T_aAttribH = 1 GUICtrlSetState ($aAddH, $GUI_ENABLE) $i_aRemove -= 1 $T_aAttribH = 0 Case GUICtrlRead ($aAddH) = $GUI_CHECKED AND $T_bAttribH = 0 GUICtrlSetState ($aRemoveH, $GUI_DISABLE) $i_aAdd += 1 $T_bAttribH = 1 Case GUICtrlRead ($aAddH) = $GUI_UNCHECKED AND $T_bAttribH = 1 GUICtrlSetState ($aRemoveH, $GUI_ENABLE) $i_aAdd -= 1 $T_bAttribH = 0 EndSelect Select Case GUICtrlRead ($aRemoveS) = $GUI_CHECKED AND $T_aAttribS = 0 GUICtrlSetState ($aAddS, $GUI_DISABLE) $i_aRemove += 1 $T_aAttribS = 1 Case GUICtrlRead ($aRemoveS) = $GUI_UNCHECKED AND $T_aAttribS = 1 GUICtrlSetState ($aAddS, $GUI_ENABLE) $i_aRemove -= 1 $T_aAttribS = 0 Case GUICtrlRead ($aAddS) = $GUI_CHECKED AND $T_bAttribS = 0 GUICtrlSetState ($aRemoveS, $GUI_DISABLE) $i_aAdd += 1 $T_bAttribS = 1 Case GUICtrlRead ($aAddS) = $GUI_UNCHECKED AND $T_bAttribS = 1 GUICtrlSetState ($aRemoveS, $GUI_ENABLE) $i_aAdd -= 1 $T_bAttribS = 0 EndSelect Select Case GUICtrlRead ($MonitorChange) = $GUI_CHECKED AND $T_MonitorChange = 0 GUICtrlSetState ($_nChange, $GUI_ENABLE) $T_MonitorChange = 1 Case GUICtrlRead ($MonitorChange) = $GUI_UNCHECKED AND $T_MonitorChange = 1 GUICtrlSetState ($_nChange, $GUI_DISABLE) $T_MonitorChange = 0 EndSelect Select Case GUICtrlRead ($MonitorTime) = $GUI_CHECKED AND $T_MonitorTime = 0 GUICtrlSetState ($_nTime, $GUI_ENABLE) $T_MonitorTime = 1 Case GUICtrlRead ($MonitorTime) = $GUI_UNCHECKED AND $T_MonitorTime = 1 GUICtrlSetState ($_nTime, $GUI_DISABLE) $T_MonitorTime = 0 EndSelect Select Case GUICtrlRead ($RunTime) = $GUI_CHECKED AND $T_RunTime = 0 GUICtrlSetState ($StartTime, $GUI_ENABLE) GUICtrlSetState ($EndTime, $GUI_ENABLE) GUICtrlSetState ($RunTimePF, $GUI_ENABLE) If $T_JobFile = '' Then GUICtrlSetState ($RunTimePF, $GUI_CHECKED) $T_RunTime = 1 Case GUICtrlRead ($RunTime) = $GUI_UNCHECKED AND $T_RunTime = 1 GUICtrlSetState ($StartTime, $GUI_DISABLE) GUICtrlSetState ($EndTime, $GUI_DISABLE) GUICtrlSetState ($RunTimePF, $GUI_DISABLE) If $T_JobFile = '' Then GUICtrlSetState ($RunTimePF, $GUI_UNCHECKED) $T_RunTime = 0 EndSelect Select Case GUICtrlRead ($IPG) = $GUI_CHECKED AND $T_IPG = 0 GUICtrlSetState ($_nIPG, $GUI_ENABLE) $T_IPG = 1 Case GUICtrlRead ($IPG) = $GUI_UNCHECKED AND $T_IPG = 1 GUICtrlSetState ($_nIPG, $GUI_DISABLE) $T_IPG = 0 EndSelect Select Case GUICtrlRead ($Retry) = $GUI_CHECKED AND $T_Retry = 0 GUICtrlSetState ($_nRetry, $GUI_ENABLE) $T_Retry = 1 Case GUICtrlRead ($Retry) = $GUI_UNCHECKED AND $T_Retry = 1 GUICtrlSetState ($_nRetry, $GUI_DISABLE) $T_Retry = 0 EndSelect Select Case GUICtrlRead ($RetryTime) = $GUI_CHECKED AND $T_RetryTime = 0 GUICtrlSetState ($_nRetryTime, $GUI_ENABLE) $T_RetryTime = 1 Case GUICtrlRead ($RetryTime) = $GUI_UNCHECKED AND $T_RetryTime = 1 GUICtrlSetState ($_nRetryTime, $GUI_DISABLE) $T_RetryTime = 0 EndSelect Select Case GUICtrlRead ($CopyArchive) = $GUI_CHECKED AND $T_CopyArchive = 0 GUICtrlSetState ($ResetArchive, $GUI_ENABLE) If $T_JobFile = '' Then GUICtrlSetState ($ResetArchive, $GUI_CHECKED) $T_CopyArchive = 1 Case GUICtrlRead ($CopyArchive) = $GUI_UNCHECKED AND $T_CopyArchive = 1 GUICtrlSetState ($ResetArchive, $GUI_DISABLE) If $T_JobFile = '' Then GUICtrlSetState ($ResetArchive, $GUI_UNCHECKED) $T_CopyArchive = 0 EndSelect Select Case GUICtrlRead ($minSize) = $GUI_CHECKED AND $T_minSize = 0 GUICtrlSetState ($minValue, $GUI_ENABLE) GUICtrlSetState ($minMeasure, $GUI_ENABLE) $T_minSize = 1 Case GUICtrlRead ($minSize) = $GUI_UNCHECKED AND $T_minSize = 1 GUICtrlSetState ($minValue, $GUI_DISABLE) GUICtrlSetState ($minMeasure, $GUI_DISABLE) $T_minSize = 0 EndSelect Select Case GUICtrlRead ($MAXSize) = $GUI_CHECKED AND $T_MAXSize = 0 GUICtrlSetState ($MAXValue, $GUI_ENABLE) GUICtrlSetState ($MAXMeasure, $GUI_ENABLE) $T_MAXSize = 1 Case GUICtrlRead ($MAXSize) = $GUI_UNCHECKED AND $T_MAXSize = 1 GUICtrlSetState ($MAXValue, $GUI_DISABLE) GUICtrlSetState ($MAXMeasure, $GUI_DISABLE) $T_MAXSize = 0 EndSelect Select Case GUICtrlRead ($minAge) = $GUI_CHECKED AND $T_minAge = 0 GUICtrlSetState ($minAgeDate, $GUI_ENABLE) $T_minAge = 1 Case GUICtrlRead ($minAge) = $GUI_UNCHECKED AND $T_minAge = 1 GUICtrlSetState ($minAgeDate, $GUI_DISABLE) $T_minAge = 0 EndSelect Select Case GUICtrlRead ($MAXAge) = $GUI_CHECKED AND $T_MAXAge = 0 GUICtrlSetState ($MAXAgeDate, $GUI_ENABLE) $T_MAXAge = 1 Case GUICtrlRead ($MAXAge) = $GUI_UNCHECKED AND $T_MAXAge = 1 GUICtrlSetState ($MAXAgeDate, $GUI_DISABLE) $T_MAXAge = 0 EndSelect Select Case GUICtrlRead ($MAXAccess) = $GUI_CHECKED AND $T_MAXAccess = 0 GUICtrlSetState ($MAXAccessDate, $GUI_ENABLE) $T_MAXAccess = 1 Case GUICtrlRead ($MAXAccess) = $GUI_UNCHECKED AND $T_MAXAccess = 1 GUICtrlSetState ($MAXAccessDate, $GUI_DISABLE) $T_MAXAccess = 0 EndSelect Select Case GUICtrlRead ($minAccess) = $GUI_CHECKED AND $T_minAccess = 0 GUICtrlSetState ($minAccessDate, $GUI_ENABLE) $T_minAccess = 1 Case GUICtrlRead ($minAccess) = $GUI_UNCHECKED AND $T_minAccess = 1 GUICtrlSetState ($minAccessDate, $GUI_DISABLE) $T_minAccess = 0 EndSelect Select Case GUICtrlRead ($jobLOG) = $GUI_CHECKED AND $T_JobLOG <> 1 GUICtrlSetTip ($jobLOG, 'Save LOG in Destination directory') GUICtrlSetState ($LOGTimeStamps, $GUI_ENABLE) GUICtrlSetState ($LOGFullPathnames, $GUI_ENABLE) GUICtrlSetState ($LOGFileSizes, $GUI_ENABLE) GUICtrlSetState ($LOGeta, $GUI_ENABLE) $T_JobLOG = 1 Case GUICtrlRead ($jobLOG) = $GUI_INDETERMINATE AND $T_JobLOG <> -1 GUICtrlSetTip ($jobLOG, 'Offer to save LOG') GUICtrlSetState ($LOGTimeStamps, $GUI_ENABLE) GUICtrlSetState ($LOGFullPathnames, $GUI_ENABLE) GUICtrlSetState ($LOGFileSizes, $GUI_ENABLE) GUICtrlSetState ($LOGeta, $GUI_ENABLE) $T_JobLOG = -1 Case GUICtrlRead ($jobLOG) = $GUI_UNCHECKED AND $T_JobLOG <> 0 GUICtrlSetTip ($jobLOG, 'Do not save LOG') GUICtrlSetState ($LOGTimeStamps, BitOR ($GUI_UNCHECKED, $GUI_DISABLE)) GUICtrlSetState ($LOGFullPathnames, BitOR ($GUI_UNCHECKED, $GUI_DISABLE)) GUICtrlSetState ($LOGFileSizes, BitOR ($GUI_UNCHECKED, $GUI_DISABLE)) If $T_JobState <> 1 Then GUICtrlSetState ($LOGeta, BitOR ($GUI_CHECKED, $GUI_DISABLE)) Else GUICtrlSetState ($LOGeta, $GUI_DISABLE) EndIf $T_JobLOG = 0 EndSelect Select Case GUICtrlRead ($jobState) = $GUI_CHECKED AND $T_JobState <> 1 GUICtrlSetTip ($jobState, 'Minimize to tray') GUICtrlSetState ($LOGeta, $GUI_UNCHECKED) $T_JobState = 1 Case GUICtrlRead ($jobState) = $GUI_INDETERMINATE AND $T_JobState <> -1 GUICtrlSetTip ($jobState, 'Terse output') $T_JobState = -1 Case GUICtrlRead ($jobState) = $GUI_UNCHECKED AND $T_JobState <> 0 GUICtrlSetTip ($jobState, 'Verbose output') $T_JobState = 0 EndSelect If $T_JobFile <> '' Then Dim $T_JobFile = '' Select Case $GUIState = $BrowseSrcDir $InitialDir = @DesktopDir $T_SrcDir = GUICtrlRead ($SrcDir) If FileExists ($T_SrcDir) Then $IsDirectory = StringInStr (FileGetAttrib ($T_SrcDir), 'D') If $IsDirectory <> 0 Then If StringRight ($T_SrcDir, 1) = '\' Then GUICtrlSetData ($SrcDir, StringTrimRight ($T_SrcDir, 1)) $InitialDir = GUICtrlRead ($SrcDir) EndIf EndIf $T_SrcDir = FileSelectFolder ('Please select the Source Directory ...', '', 4, $InitialDir, $GUIRoboCopy) If @error = 1 Then ContinueLoop If StringRight ($T_SrcDir, 1) = '\' Then $T_SrcDir = StringTrimRight ($T_SrcDir, 1) GUICtrlSetData ($SrcDir, $T_SrcDir) Case $GUIState = $BrowseDestDir $InitialDir = @DesktopDir $T_DestDir = GUICtrlRead ($DestDir) If FileExists ($T_DestDir) Then $IsDirectory = StringInStr (FileGetAttrib ($T_DestDir), 'D') If $IsDirectory <> 0 Then If StringRight ($T_DestDir, 1) = '\' Then GUICtrlSetData ($DestDir, StringTrimRight ($T_DestDir, 1)) $InitialDir = GUICtrlRead ($DestDir) EndIf EndIf $T_DestDir = FileSelectFolder ('Please select the Destination Directory ...', '', 4, $InitialDir, $GUIRoboCopy) If @error = 1 Then ContinueLoop If StringRight ($T_DestDir, 1) = '\' Then $T_DestDir = StringTrimRight ($T_DestDir, 1) GUICtrlSetData ($DestDir, $T_DestDir) Case $GUIState = $MenuHelpRC ShellExecute ('https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy') Case $GUIState = $MenuHelpGUI fDisplayHelp($GUIRoboCopy) Case $GUIState = $MenuJobClear fReset(True) GUICtrlSetData ($SrcDir, '') GUICtrlSetData ($DestDir, '') GUICtrlSetData ($SrcFiles, '*.*') Case $GUIState = $MenuPresetCopyOnce fReset() GUICtrlSetState ($RestartableMode, $GUI_CHECKED) GUICtrlSetState ($CopySubDir, $GUI_CHECKED) GUICtrlSetState ($Retry, $GUI_CHECKED) GUICtrlSetState ($RetryTime, $GUI_CHECKED) GUICtrlSetState ($RetryNet, $GUI_CHECKED) GUICtrlSetState ($eXcludeOld, $GUI_CHECKED) GUICtrlSetState ($eXcludeE, $GUI_CHECKED) GUICtrlSetState ($eXcludeJ, $GUI_CHECKED) GUICtrlSetState ($LOGeta, $GUI_CHECKED) Case $GUIState = $MenuPresetCopy fReset() GUICtrlSetState ($RestartableMode, $GUI_CHECKED) GUICtrlSetState ($CopySubDir, $GUI_CHECKED) GUICtrlSetState ($Retry, $GUI_CHECKED) GUICtrlSetState ($RetryTime, $GUI_CHECKED) GUICtrlSetState ($RetryNet, $GUI_CHECKED) GUICtrlSetState ($eXcludeOld, $GUI_CHECKED) GUICtrlSetState ($eXcludeE, $GUI_CHECKED) GUICtrlSetState ($eXcludeJ, $GUI_CHECKED) GUICtrlSetState ($MonitorChange, $GUI_CHECKED) GUICtrlSetState ($MonitorTime, $GUI_CHECKED) GUICtrlSetState ($LOGeta, $GUI_CHECKED) Case $GUIState = $MenuPresetMirror fReset() GUICtrlSetState ($CopySubDir, $GUI_CHECKED) GUICtrlSetState ($Purge, $GUI_CHECKED) GUICtrlSetState ($Retry, $GUI_CHECKED) GUICtrlSetState ($RetryTime, $GUI_CHECKED) GUICtrlSetState ($RetryNet, $GUI_CHECKED) GUICtrlSetState ($eXcludeE, $GUI_CHECKED) GUICtrlSetState ($eXcludeJ, $GUI_CHECKED) GUICtrlSetState ($MonitorChange, $GUI_CHECKED) GUICtrlSetState ($MonitorTime, $GUI_CHECKED) GUICtrlSetState ($LOGeta, $GUI_CHECKED) Case $GUIState = $_MonitorChange If GUICtrlRead ($MonitorChange) = $GUI_UNCHECKED Then GUICtrlSetState ($MonitorChange, $GUI_CHECKED) Else GUICtrlSetState ($MonitorChange, $GUI_UNCHECKED) EndIf Case $GUIState = $_MonitorTime If GUICtrlRead ($MonitorTime) = $GUI_UNCHECKED Then GUICtrlSetState ($MonitorTime, $GUI_CHECKED) Else GUICtrlSetState ($MonitorTime, $GUI_UNCHECKED) EndIf Case $GUIState = $_RunTime If GUICtrlRead ($RunTime) = $GUI_UNCHECKED Then GUICtrlSetState ($RunTime, $GUI_CHECKED) Else GUICtrlSetState ($RunTime, $GUI_UNCHECKED) EndIf Case $GUIState = $MenuJobSave $T_JobFile = FileSaveDialog ('RoboCopy - RoboCopy Job', @DesktopDir, 'GUI Job files (*.gjb)', 18, 'RoboCopy (' & $TempFileName & ').gjb', $GUIRoboCopy) If @error = 1 Then ContinueLoop If StringRight (StringUpper ($T_JobFile), 4) <> '.GJB' Then $T_JobFile = $T_JobFile & '.gjb' IniWrite ($T_JobFile, 'PATH_FILE', 'SrcDir', GUICtrlRead ($SrcDir)) IniWrite ($T_JobFile, 'PATH_FILE', 'DestDir', GUICtrlRead ($DestDir)) IniWrite ($T_JobFile, 'PATH_FILE', 'SrcFiles', GUICtrlRead ($SrcFiles)) $T_OptionState = 0 If GUICtrlRead ($RestartableMode) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'RestartableMode', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($CopySubDir) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'CopySubDir', $T_OptionState) IniWrite ($T_JobFile, 'COPY', 'CopySubDirOption', GUICtrlRead ($CopySubDirOption)) IniWrite ($T_JobFile, 'COPY', 'nLevels', GUICtrlRead ($nLevels)) $T_OptionState = 0 If GUICtrlRead ($CopyS) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'CopyS', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($CopyO) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'CopyO', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($CopyU) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'CopyU', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($Purge) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'Purge', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($Move) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'Move', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aRemoveA) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aRemoveA', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aRemoveR) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aRemoveR', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aRemoveH) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aRemoveH', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aRemoveS) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aRemoveS', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aAddA) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aAddA', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aAddR) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aAddR', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aAddH) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aAddH', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($aAddS) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'COPY', 'aAddS', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($MonitorChange) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'MonitorChange', $T_OptionState) IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'nChange', GUICtrlRead ($nChange)) $T_OptionState = 0 If GUICtrlRead ($MonitorTime) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'MonitorTime', $T_OptionState) IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'nTime', GUICtrlRead ($nTime)) $T_OptionState = 0 If GUICtrlRead ($RunTime) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'RunTime', $T_OptionState) IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'StartTime', GUICtrlRead ($StartTime)) IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'EndTime', GUICtrlRead ($EndTime)) $T_OptionState = 0 If GUICtrlRead ($RunTimePF) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'RunTimePF', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($IPG) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'IPG', $T_OptionState) IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'nIPG', GUICtrlRead ($nIPG)) $T_OptionState = 0 If GUICtrlRead ($Retry) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'Retry', $T_OptionState) IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'nRetry', GUICtrlRead ($nRetry)) $T_OptionState = 0 If GUICtrlRead ($RetryTime) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'RetryTime', $T_OptionState) IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'nRetryTime', GUICtrlRead ($nRetryTime)) $T_OptionState = 0 If GUICtrlRead ($RetryNet) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'MONITORING_TIME_RETRY', 'RetryNet', $T_OptionState) IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeFiles', GUICtrlRead ($eXcludeFiles)) IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeDirs', GUICtrlRead ($eXcludeDirs)) $T_OptionState = 0 If GUICtrlRead ($eXcludeOld) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeOld', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($eXcludeC) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeC', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($eXcludeE) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeE', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($eXcludeT) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeT', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($eXcludeO) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeO', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($eXcludeJ) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'eXcludeJ', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($CopyArchive) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'CopyArchive', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($ResetArchive) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'ResetArchive', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($minSize) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'minSize', $T_OptionState) IniWrite ($T_JobFile, 'FILE_SELECTION', 'minValue', GUICtrlRead ($minValue)) IniWrite ($T_JobFile, 'FILE_SELECTION', 'minMeasure', GUICtrlRead ($minMeasure)) $T_OptionState = 0 If GUICtrlRead ($MAXSize) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'MAXSize', $T_OptionState) IniWrite ($T_JobFile, 'FILE_SELECTION', 'MAXValue', GUICtrlRead ($MAXValue)) IniWrite ($T_JobFile, 'FILE_SELECTION', 'MAXMeasure', GUICtrlRead ($MAXMeasure)) $T_OptionState = 0 If GUICtrlRead ($minAge) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'minAge', $T_OptionState) IniWrite ($T_JobFile, 'FILE_SELECTION', 'minAgeDate', GUICtrlRead ($minAgeDate)) $T_OptionState = 0 If GUICtrlRead ($MAXAge) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'MAXAge', $T_OptionState) IniWrite ($T_JobFile, 'FILE_SELECTION', 'MAXAgeDate', GUICtrlRead ($MAXAgeDate)) $T_OptionState = 0 If GUICtrlRead ($MAXAccess) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'MAXAccess', $T_OptionState) IniWrite ($T_JobFile, 'FILE_SELECTION', 'MAXAccessDate', GUICtrlRead ($MAXAccessDate)) $T_OptionState = 0 If GUICtrlRead ($minAccess) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'FILE_SELECTION', 'minAccess', $T_OptionState) IniWrite ($T_JobFile, 'FILE_SELECTION', 'minAccessDate', GUICtrlRead ($minAccessDate)) $T_OptionState = 0 If GUICtrlRead ($LOGTimeStamps) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'LOGGING', 'LOGTimeStamps', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($LOGFullPathnames) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'LOGGING', 'LOGFullPathnames', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($LOGFileSizes) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'LOGGING', 'LOGFileSizes', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($LOGeta) = $GUI_CHECKED Then $T_OptionState = 1 IniWrite ($T_JobFile, 'LOGGING', 'LOGeta', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($jobLOG) = $GUI_CHECKED Then $T_OptionState = 1 If GUICtrlRead ($jobLOG) = $GUI_INDETERMINATE Then $T_OptionState = -1 IniWrite ($T_JobFile, 'LOGGING', 'LOGEnable', $T_OptionState) $T_OptionState = 0 If GUICtrlRead ($jobState) = $GUI_CHECKED Then $T_OptionState = 1 If GUICtrlRead ($jobState) = $GUI_INDETERMINATE Then $T_OptionState = -1 IniWrite ($T_JobFile, 'JOB', 'State', $T_OptionState) MsgBox (262208, 'RoboCopy', 'Job have been successfully saved to' & @CRLF & $T_JobFile, 5, $GUIRoboCopy) Case $GUIState = $MenuJobLoad OR $GUIState = $GUI_EVENT_DROPPED OR $T_JobLoad If $GUIState = $GUI_EVENT_DROPPED Then $T_JobFile = @GUI_DRAGFILE If StringRight (StringUpper ($T_JobFile), 4) <> '.GJB' Then $T_JobFile = $T_JobFile & '.gjb' If NOT FileExists ($T_JobFile) Then ContinueLoop ElseIf $T_JobLoad Then Dim $T_JobLoad = False, $T_JobFile = $T_JobLoadFile Else $T_JobFile = FileOpenDialog ('RoboCopy - RoboCopy Job', @DesktopDir, 'GUI Job files (*.gjb)', 3, '', $GUIRoboCopy) If @error = 1 Then ContinueLoop If StringRight (StringUpper ($T_JobFile), 4) <> '.GJB' Then $T_JobFile = $T_JobFile & '.gjb' If NOT FileExists ($T_JobFile) Then MsgBox (262160, 'RoboCopy', 'There is no such file' & @CRLF & $T_JobFile, 5, $GUIRoboCopy) ContinueLoop EndIf EndIf fReset(True) GUICtrlSetData ($SrcDir, IniRead ($T_JobFile, 'PATH_FILE', 'SrcDir', '')) GUICtrlSetData ($DestDir, IniRead ($T_JobFile, 'PATH_FILE', 'DestDir', '')) GUICtrlSetData ($SrcFiles, IniRead ($T_JobFile, 'PATH_FILE', 'SrcFiles', '')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'RestartableMode', 1) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($RestartableMode, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'CopySubDir', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($CopySubDir, $T_OptionState) GUICtrlSetData ($CopySubDirOption, IniRead ($T_JobFile, 'COPY', 'CopySubDirOption', 'Copy empty directories'), IniRead ($T_JobFile, 'COPY', 'CopySubDirOption', 'Copy empty directories')) GUICtrlSetData ($nLevels, IniRead ($T_JobFile, 'COPY', 'nLevels', '1')) $T_OptionState = $GUI_UNCHECKED If IsAdmin () AND IniRead ($T_JobFile, 'COPY', 'CopyS', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($CopyS, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IsAdmin () AND IniRead ($T_JobFile, 'COPY', 'CopyO', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($CopyO, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IsAdmin () AND IniRead ($T_JobFile, 'COPY', 'CopyU', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($CopyU, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'Purge', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($Purge, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'Move', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($Move, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aRemoveA', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aRemoveA, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aRemoveR', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aRemoveR, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aRemoveH', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aRemoveH, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aRemoveS', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aRemoveS, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aAddA', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aAddA, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aAddR', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aAddR, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aAddH', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aAddH, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'COPY', 'aAddS', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($aAddS, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'MonitorChange', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($MonitorChange, $T_OptionState) GUICtrlSetData ($nChange, IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'nChange', '1')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'MonitorTime', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($MonitorTime, $T_OptionState) GUICtrlSetData ($nTime, IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'nTime', '1')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'RunTime', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($RunTime, $T_OptionState) GUICtrlSetData ($StartTime, @YEAR & '/' & @MON & '/' & @MDAY & ' ' & IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'StartTime', '22:00')) GUICtrlSetData ($EndTime, @YEAR & '/' & @MON & '/' & @MDAY & ' ' & IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'EndTime', '06:00')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'RunTimePF', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($RunTimePF, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'IPG', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($IPG, $T_OptionState) GUICtrlSetData ($nIPG, IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'nIPG', '1')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'Retry', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($Retry, $T_OptionState) GUICtrlSetData ($nRetry, IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'nRetry', '3')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'RetryTime', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($RetryTime, $T_OptionState) GUICtrlSetData ($nRetryTime, IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'nRetryTime', '5')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'MONITORING_TIME_RETRY', 'RetryNet', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($RetryNet, $T_OptionState) GUICtrlSetData ($eXcludeFiles, IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeFiles', '')) GUICtrlSetData ($eXcludeDirs, IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeDirs', '')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'CopyArchive', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($CopyArchive, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'ResetArchive', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($ResetArchive, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeOld', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($eXcludeOld, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeC', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($eXcludeC, $T_OptionState) $T_OptionState = $GUI_CHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeE', 1) = 0 Then $T_OptionState = $GUI_UNCHECKED GUICtrlSetState ($eXcludeE, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeT', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($eXcludeT, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeO', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($eXcludeO, $T_OptionState) $T_OptionState = $GUI_CHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'eXcludeJ', 1) = 0 Then $T_OptionState = $GUI_UNCHECKED GUICtrlSetState ($eXcludeJ, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'minSize', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($minSize, $T_OptionState) GUICtrlSetData ($minValue, IniRead ($T_JobFile, 'FILE_SELECTION', 'minValue', '')) GUICtrlSetData ($minMeasure, IniRead ($T_JobFile, 'FILE_SELECTION', 'minMeasure', 'KB'), IniRead ($T_JobFile, 'FILE_SELECTION', 'minMeasure', 'KB')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXSize', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($MAXSize, $T_OptionState) GUICtrlSetData ($MAXValue, IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXValue', '')) GUICtrlSetData ($MAXMeasure, IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXMeasure', 'KB'), IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXMeasure', 'KB')) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'minAge', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($minAge, $T_OptionState) $T_OptionDate = StringSplit (IniRead ($T_JobFile, 'FILE_SELECTION', 'minAgeDate', @MDAY & '/' & @MON & '/' & @YEAR), '.') GUICtrlSetData ($minAgeDate, $T_OptionDate[3] & '/' & $T_OptionDate[2] & '/' & $T_OptionDate[1]) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXAge', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($MAXAge, $T_OptionState) $T_OptionDate = StringSplit (IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXAgeDate', @MDAY & '/' & @MON & '/' & @YEAR), '.') GUICtrlSetData ($MAXAgeDate, $T_OptionDate[3] & '/' & $T_OptionDate[2] & '/' & $T_OptionDate[1]) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXAccess', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($MAXAccess, $T_OptionState) $T_OptionDate = StringSplit (IniRead ($T_JobFile, 'FILE_SELECTION', 'MAXAccessDate', @MDAY & '/' & @MON & '/' & @YEAR), '.') GUICtrlSetData ($MAXAccessDate, $T_OptionDate[3] & '/' & $T_OptionDate[2] & '/' & $T_OptionDate[1]) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'FILE_SELECTION', 'minAccess', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($minAccess, $T_OptionState) $T_OptionDate = StringSplit (IniRead ($T_JobFile, 'FILE_SELECTION', 'minAccessDate', @MDAY & '/' & @MON & '/' & @YEAR), '.') GUICtrlSetData ($minAccessDate, $T_OptionDate[3] & '/' & $T_OptionDate[2] & '/' & $T_OptionDate[1]) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'LOGGING', 'LOGTimeStamps', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($LOGTimeStamps, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'LOGGING', 'LOGFullPathnames', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($LOGFullPathnames, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'LOGGING', 'LOGFileSizes', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($LOGFileSizes, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'LOGGING', 'LOGeta', 0) = 1 Then $T_OptionState = $GUI_CHECKED GUICtrlSetState ($LOGeta, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'LOGGING', 'LOGEnable', 0) = 1 Then $T_OptionState = $GUI_CHECKED If IniRead ($T_JobFile, 'LOGGING', 'LOGEnable', 0) = -1 Then $T_OptionState = $GUI_INDETERMINATE GUICtrlSetState ($jobLOG, $T_OptionState) $T_OptionState = $GUI_UNCHECKED If IniRead ($T_JobFile, 'JOB', 'State', 0) = 1 Then $T_OptionState = $GUI_CHECKED If IniRead ($T_JobFile, 'JOB', 'State', 0) = -1 Then $T_OptionState = $GUI_INDETERMINATE GUICtrlSetState ($jobState, $T_OptionState) Case $GUIState = $MenuProcessJobs $jobRootDir = FileSelectFolder ('Please select the folder where RoboCopy Jobs ("*.gjb") are located.', @ScriptDir, 0, '', $GUIRoboCopy) If $jobRootDir = '' Then ContinueLoop If StringRight ($jobRootDir, 1) = '\' Then $jobRootDir = StringTrimRight ($jobRootDir, 1) If NOT FileExists ($jobRootDir & '\*.gjb') AND MsgBox (262192, 'RoboCopy', 'Please specify a valid RoboCopy Jobs directory ...', 5, $GUIRoboCopy) Then ContinueLoop GUISetState (@SW_MINIMIZE, $GUIRoboCopy) GUISetState (@SW_HIDE, $GUIRoboCopy) fLoadJobs($jobRootDir) GUISetState (@SW_SHOW, $GUIRoboCopy) GUISetState (@SW_RESTORE, $GUIRoboCopy) Case $GUIState = $LinkView OR $GUIState = $ButtonStart OR $T_JobStart If $T_JobStart Then Dim $GUIState = $ButtonStart, $T_JobStart = False If NOT FileExists (@TempDir) Then DirCreate (@TempDir) If FileExists (@TempDir & '\RoboCopy (' & $TempFileName & ').log') Then FileDelete (@TempDir & '\RoboCopy (' & $TempFileName & ').log') If GUICtrlRead ($SrcFiles) = '' Then GUICtrlSetData ($SrcFiles, '*.*') $i_SrcDir = GUICtrlRead ($SrcDir) If $i_SrcDir = '' OR NOT FileExists ($i_SrcDir) OR NOT StringInStr (FileGetAttrib ($i_SrcDir), 'D') Then If $GUIState = $ButtonStart AND MsgBox (262192, 'RoboCopy', 'Please specify a valid source directory ...', 5, $GUIRoboCopy) Then ContinueLoop $i_SrcDir = '%SourceDirectory%' EndIf If StringRight ($i_SrcDir, 1) = '\' Then $i_SrcDir = StringTrimRight ($i_SrcDir, 1) $i_DestDir = GUICtrlRead ($DestDir) If $i_DestDir = '' OR NOT FileExists ($i_DestDir) OR NOT StringInStr (FileGetAttrib ($i_DestDir), 'D') Then If $GUIState = $ButtonStart AND MsgBox (262192, 'RoboCopy', 'Please specify a valid destination directory ...', 5, $GUIRoboCopy) Then ContinueLoop $i_DestDir = '%DestinationDirectory%' Else $i_DestDirGetAttrib = FileGetAttrib ($i_DestDir) EndIf If StringRight ($i_DestDir, 1) = '\' Then $i_DestDir = StringTrimRight ($i_DestDir, 1) Dim $CommandLine = '' $CommandLine &= ' "' & $i_SrcDir & '"' $CommandLine &= ' "' & $i_DestDir & '"' $i_SrcFiles = StringSplit (GUICtrlRead ($SrcFiles) & ';', ';') For $i = 1 To $i_SrcFiles[0] If $i_SrcFiles[$i] = '' Then ContinueLoop $CommandLine &= ' "' & StringStripWS ($i_SrcFiles[$i], 3) & '"' Next If IsAdmin () AND GUICtrlRead ($RestartableMode) = $GUI_CHECKED Then $CommandLine &= ' /ZB' ElseIf GUICtrlRead ($RestartableMode) = $GUI_CHECKED Then $CommandLine &= ' /Z' ElseIf IsAdmin () Then $CommandLine &= ' /B' EndIf If GUICtrlRead ($CopySubDir) = $GUI_CHECKED Then Switch GUICtrlRead ($CopySubDirOption) Case 'Copy empty directories' $CommandLine &= ' /E' Case 'Discard empty directories' $CommandLine &= ' /S' Case 'Copy top "n" levels' $CommandLine &= ' /LEV:' & GUICtrlRead ($nLevels) EndSwitch EndIf $CommandLine &= ' /COPY:DAT' If IsAdmin () AND GUICtrlRead ($CopyS) = $GUI_CHECKED Then $CommandLine &= 'S' If IsAdmin () AND GUICtrlRead ($CopyO) = $GUI_CHECKED Then $CommandLine &= 'O' If IsAdmin () AND GUICtrlRead ($CopyU) = $GUI_CHECKED Then $CommandLine &= 'U' $CommandLine &= ' /DCOPY:DAT' If GUICtrlRead ($Purge) = $GUI_CHECKED Then $CommandLine &= ' /PURGE' If GUICtrlRead ($Move) = $GUI_CHECKED Then $CommandLine &= ' /MOVE' If $i_aRemove > 0 Then $CommandLine &= ' /A-:' If GUICtrlRead ($aRemoveA) = $GUI_CHECKED Then $CommandLine &= 'A' If GUICtrlRead ($aRemoveR) = $GUI_CHECKED Then $CommandLine &= 'R' If GUICtrlRead ($aRemoveH) = $GUI_CHECKED Then $CommandLine &= 'H' If GUICtrlRead ($aRemoveS) = $GUI_CHECKED Then $CommandLine &= 'S' EndIf If $i_aAdd > 0 Then $CommandLine &= ' /A+:' If GUICtrlRead ($aAddA) = $GUI_CHECKED Then $CommandLine &= 'A' If GUICtrlRead ($aAddR) = $GUI_CHECKED Then $CommandLine &= 'R' If GUICtrlRead ($aAddH) = $GUI_CHECKED Then $CommandLine &= 'H' If GUICtrlRead ($aAddS) = $GUI_CHECKED Then $CommandLine &= 'S' EndIf If GUICtrlRead ($MonitorChange) = $GUI_CHECKED Then $CommandLine &= ' /MON:' & GUICtrlRead ($nChange) If GUICtrlRead ($MonitorTime) = $GUI_CHECKED Then $CommandLine &= ' /MOT:' & GUICtrlRead ($nTime) If GUICtrlRead ($RunTime) = $GUI_CHECKED Then $CommandLine &= ' /RH:' & StringReplace (GUICtrlRead ($StartTime), ':', '', 0, 2) & '-' & StringReplace (GUICtrlRead ($EndTime), ':', '', 0, 2) If GUICtrlRead ($RunTimePF) = $GUI_CHECKED Then $CommandLine &= ' /PF' If GUICtrlRead ($IPG) = $GUI_CHECKED Then $CommandLine &= ' /IPG:' & GUICtrlRead ($nIPG) If GUICtrlRead ($Retry) = $GUI_CHECKED Then $CommandLine &= ' /R:' & GUICtrlRead ($nRetry) If GUICtrlRead ($RetryTime) = $GUI_CHECKED Then $CommandLine &= ' /W:' & GUICtrlRead ($nRetryTime) If GUICtrlRead ($RetryNet) = $GUI_CHECKED Then $CommandLine &= ' /TBD' If GUICtrlRead ($eXcludeFiles) <> '' Then $CommandLine &= ' /XF' $i_eXcludeFiles = StringSplit (GUICtrlRead ($eXcludeFiles) & ';', ';') For $i = 1 To $i_eXcludeFiles[0] If $i_eXcludeFiles[$i] = '' Then ContinueLoop $CommandLine &= ' "' & StringStripWS ($i_eXcludeFiles[$i], 3) & '"' Next EndIf $CommandLine &= ' /XD "System Volume Information" "$RECYCLE.BIN"' If GUICtrlRead ($eXcludeDirs) <> '' Then $i_eXcludeDirs = StringSplit (GUICtrlRead ($eXcludeDirs) & ';', ';') For $i = 1 To $i_eXcludeDirs[0] If $i_eXcludeDirs[$i] = '' Then ContinueLoop $CommandLine &= ' "' & StringStripWS ($i_eXcludeDirs[$i], 3) & '"' Next EndIf If GUICtrlRead ($ResetArchive) = $GUI_CHECKED Then $CommandLine &= ' /M' ElseIf GUICtrlRead ($CopyArchive) = $GUI_CHECKED Then $CommandLine &= ' /A' EndIf If GUICtrlRead ($eXcludeOld) = $GUI_CHECKED Then $CommandLine &= ' /XO' $i_Exclude = '' If GUICtrlRead ($eXcludeC) = $GUI_CHECKED Then $i_Exclude = $i_Exclude & 'C' If GUICtrlRead ($eXcludeE) = $GUI_CHECKED Then $i_Exclude = $i_Exclude & 'E' If GUICtrlRead ($eXcludeT) = $GUI_CHECKED Then $i_Exclude = $i_Exclude & 'T' If GUICtrlRead ($eXcludeO) = $GUI_CHECKED Then $i_Exclude = $i_Exclude & 'O' If $i_Exclude <> '' Then $CommandLine &= ' /XA:' & $i_Exclude If GUICtrlRead ($eXcludeJ) = $GUI_CHECKED Then $CommandLine &= ' /XJ' If GUICtrlRead ($minSize) = $GUI_CHECKED AND GUICtrlRead ($minValue) <> '' Then $CommandLine &= ' /MIN:' $i_Value = GUICtrlRead ($minValue) For $i = 1 to $SetMeasureUnits[0] If GUICtrlRead ($minMeasure) = $SetMeasureUnits[$i] Then $CommandLine &= ($i_Value * 1024^$i) Next EndIf If GUICtrlRead ($MAXSize) = $GUI_CHECKED AND GUICtrlRead ($MAXValue) <> '' Then $CommandLine &= ' /MAX:' $i_Value = GUICtrlRead ($MAXValue) For $i = 1 to $SetMeasureUnits[0] If GUICtrlRead ($MAXMeasure) = $SetMeasureUnits[$i] Then $CommandLine &= ($i_Value * 1024^$i) Next EndIf If GUICtrlRead ($minAge) = $GUI_CHECKED Then $i_Date = StringSplit (GUICtrlRead ($minAgeDate), '.') $CommandLine &= ' /MINAGE:' & $i_Date[3] & $i_Date[2] & $i_Date[1] EndIf If GUICtrlRead ($MAXAge) = $GUI_CHECKED Then $i_Date = StringSplit (GUICtrlRead ($MAXAgeDate), '.') $CommandLine &= ' /MAXAGE:' & $i_Date[3] & $i_Date[2] & $i_Date[1] EndIf If GUICtrlRead ($MAXAccess) = $GUI_CHECKED Then $i_Date = StringSplit (GUICtrlRead ($MAXAccessDate), '.') $CommandLine &= ' /MAXLAD:' & $i_Date[3] & $i_Date[2] & $i_Date[1] EndIf If GUICtrlRead ($minAccess) = $GUI_CHECKED Then $i_Date = StringSplit (GUICtrlRead ($minAccessDate), '.') $CommandLine &= ' /MINLAD:' & $i_Date[3] & $i_Date[2] & $i_Date[1] EndIf $CommandLine &= ' /LOG:"' & @TempDir & '\RoboCopy (' & $TempFileName & ').log" /TEE' If GUICtrlRead ($LOGTimeStamps) = $GUI_CHECKED Then $CommandLine &= ' /TS' If GUICtrlRead ($LOGFullPathnames) = $GUI_CHECKED Then $CommandLine &= ' /FP' If GUICtrlRead ($LOGFileSizes) = $GUI_CHECKED Then $CommandLine &= ' /NS' If GUICtrlRead ($LOGeta) = $GUI_CHECKED Then $CommandLine &= ' /ETA' If GUICtrlRead ($jobState) = $GUI_UNCHECKED Then $CommandLine &= ' /V' If $GUIState = $ButtonStart Then If FileExists (@SystemDir & '\RoboCopy.exe') Then $RoboCopyPath = @SystemDir & '\RoboCopy.exe' Else FileInstall ('.\DATA\v5.1.1.1010\x86\RoboCopy.exe', @TempDir & '\RoboCopy.exe', 1) $RoboCopyPath = @TempDir & '\RoboCopy.exe' EndIf GUISetState (@SW_MINIMIZE, $GUIRoboCopy) GUISetState (@SW_HIDE, $GUIRoboCopy) Dim $SW_STATUS = @SW_SHOW, $TrayTip = 0 If GUICtrlRead ($jobState) = $GUI_CHECKED Then Dim $SW_STATUS = @SW_HIDE, $TrayTip = 1 AutoItSetOption ('TrayIconHide', 0) TraySetToolTip ('RoboCopy') EndIf $RoboCopyPID = Run ($RoboCopyPath & $CommandLine, @TempDir, $SW_STATUS) $ProcessStop = 0 Else $GUIView = GUICreate ('RoboCopy - Microsoft RoboCopy Command line options', 500, 150, -1, -1, $WS_CAPTION + $WS_POPUP + $WS_SYSMENU, -1, $GUIRoboCopy) $CMDline = GUICtrlCreateEdit ('RoboCopy.exe' & $CommandLine, 10, 10, 480, 105, $ES_AUTOVSCROLL + $ES_READONLY + $WS_VSCROLL) GUICtrlSetFont ($CMDline, 11, 500) $ButtonCopy = GUICtrlCreateButton ('Copy', 420, 123, 75, 22) GUICtrlSetTip ($ButtonCopy, 'Copy to clipboard and exit') GUICtrlSetState ($ButtonCopy, $GUI_DEFBUTTON) GUICtrlSetState ($ButtonCopy, $GUI_FOCUS) GUISetState (@SW_DISABLE, $GUIRoboCopy) GUISetState (@SW_SHOW, $GUIView) While 'View Command Line' $GUIState = GUIGetMsg () Select Case $GUIState = $ButtonCopy ClipPut ('RoboCopy.exe' & $CommandLine) ExitLoop Case $GUIState = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete ($GUIView) GUISetState (@SW_ENABLE, $GUIRoboCopy) WinActivate ($GUIRoboCopy) EndIf Case $ProcessStop = 1 OR ($ProcessStop = 0 AND NOT ProcessExists ($RoboCopyPID)) GUISetState (@SW_SHOW, $GUIRoboCopy) GUISetState (@SW_RESTORE, $GUIRoboCopy) $TrayTip = 0 AutoItSetOption ('TrayIconHide', 1) If $i_DestDirGetAttrib <> '' Then $i_DestDirSetAttrib = '+RASH-' If NOT StringInStr ($i_DestDirGetAttrib, 'R') Then $i_DestDirSetAttrib = StringReplace ($i_DestDirSetAttrib, 'R', '') $i_DestDirSetAttrib &= 'R' EndIf If NOT StringInStr ($i_DestDirGetAttrib, 'A') Then $i_DestDirSetAttrib = StringReplace ($i_DestDirSetAttrib, 'A', '') $i_DestDirSetAttrib &= 'A' EndIf If NOT StringInStr ($i_DestDirGetAttrib, 'S') Then $i_DestDirSetAttrib = StringReplace ($i_DestDirSetAttrib, 'S', '') $i_DestDirSetAttrib &= 'S' EndIf If NOT StringInStr ($i_DestDirGetAttrib, 'H') Then $i_DestDirSetAttrib = StringReplace ($i_DestDirSetAttrib, 'H', '') $i_DestDirSetAttrib &= 'H' EndIf If StringLeft ($i_DestDirSetAttrib, 2) = '+-' Then $i_DestDirSetAttrib = StringTrimLeft ($i_DestDirSetAttrib, 1) If StringRight ($i_DestDirSetAttrib, 1) = '-' Then $i_DestDirSetAttrib = StringTrimRight ($i_DestDirSetAttrib, 1) FileSetAttrib ($i_DestDir, $i_DestDirSetAttrib, 0) EndIf If FileExists (@TempDir & '\RoboCopy (' & $TempFileName & ').log') Then If $T_JobLOG = -1 AND MsgBox (262436, 'RoboCopy', 'Do you wish to save Microsoft RoboCopy Job LOG.', 0, $GUIRoboCopy) = 6 Then $i_LOGFile = FileSaveDialog ('RoboCopy - Microsoft RoboCopy Job LOG', @DesktopDir, 'LOG files (*.log)', 18, 'RoboCopy (' & $TempFileName & ').log', $GUIRoboCopy) If NOT @error Then If StringRight (StringUpper ($i_LOGFile), 4) <> '.LOG' Then $i_LOGFile = $i_LOGFile & '.log' FileCopy (@TempDir & '\RoboCopy (' & $TempFileName & ').log', $i_LOGFile, 1) EndIf ElseIf $T_JobLOG = 1 Then $i_DestDir = GUICtrlRead ($DestDir) If StringRight ($i_DestDir, 1) = '\' Then $i_DestDir = StringTrimRight ($i_DestDir, 1) If $i_DestDir <> '' AND FileExists ($i_DestDir) AND StringInStr (FileGetAttrib ($i_DestDir), 'D') Then FileCopy (@TempDir & '\RoboCopy (' & $TempFileName & ').log', $i_DestDir & '\RoboCopy (' & $TempFileName & ').log', 1) EndIf EndIf EndIf If ProcessExists ($RoboCopyPID) AND NOT ProcessClose ($RoboCopyPID) Then MsgBox (262192, 'RoboCopy', 'The process was left hanging. Please stop the "RoboCopy" process manualy.', 0, $GUIRoboCopy) FileDelete (@TempDir & '\RoboCopy (' & $TempFileName & ').log') Dim $ProcessStop = -1, $RoboCopyPID = 0, $T_Idling = '', $T_Copying = 0 If $T_JobExit Then ExitLoop Case $ProcessStop = 0 AND $TrayTip $T_PullEnd = TimerDiff ($T_PullStart) If $T_PullEnd < $PullTime Then ContinueLoop Dim $T_PullStart = TimerInit (), $T_PullEnd = TimerDiff ($T_PullStart) $LogHandle = FileOpen (@TempDir & '\RoboCopy (' & $TempFileName & ').log', 0) $LogContents = StringReplace (StringStripWS (FileReadLine ($LogHandle, -1), 7), '.', '') FileClose ($LogHandle) If $LogContents <> $T_Idling AND StringInStr ($LogContents, 'changes') Then $T_Idling = $LogContents $T_Copying = 0 TraySetToolTip ('RoboCopy (' & $LogContents & ')') ElseIf $T_Copying = 0 AND NOT StringInStr ($LogContents, 'changes') Then $T_Copying = 1 TraySetToolTip ('RoboCopy (Copying)') EndIf Case $GUIState = $ButtonExit OR $GUIState = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete ($GUIRoboCopy) Exit Func fReset($ResetClear = False) GUICtrlSetState ($RestartableMode, $GUI_UNCHECKED) GUICtrlSetState ($CopySubDir, $GUI_CHECKED) GUICtrlSetData ($CopySubDirOption, 'Copy empty directories', 'Copy empty directories') GUICtrlSetData ($nLevels, '1') GUICtrlSetState ($CopyS, $GUI_UNCHECKED) GUICtrlSetState ($CopyO, $GUI_UNCHECKED) GUICtrlSetState ($CopyU, $GUI_UNCHECKED) GUICtrlSetState ($Purge, $GUI_UNCHECKED) GUICtrlSetState ($Move, $GUI_UNCHECKED) GUICtrlSetState ($aRemoveA, $GUI_UNCHECKED) GUICtrlSetState ($aRemoveR, $GUI_UNCHECKED) GUICtrlSetState ($aRemoveH, $GUI_UNCHECKED) GUICtrlSetState ($aRemoveS, $GUI_UNCHECKED) GUICtrlSetState ($aAddA, $GUI_UNCHECKED) GUICtrlSetState ($aAddR, $GUI_UNCHECKED) GUICtrlSetState ($aAddH, $GUI_UNCHECKED) GUICtrlSetState ($aAddS, $GUI_UNCHECKED) GUICtrlSetState ($MonitorChange, $GUI_UNCHECKED) GUICtrlSetData ($nChange, '1') GUICtrlSetState ($MonitorTime, $GUI_UNCHECKED) GUICtrlSetData ($nTime, '1') GUICtrlSetState ($RunTime, $GUI_UNCHECKED) GUICtrlSetData ($StartTime, @YEAR & '/' & @MON & '/' & @MDAY & ' ' & '22:00') GUICtrlSetData ($EndTime, @YEAR & '/' & @MON & '/' & @MDAY & ' ' & '06:00') GUICtrlSetState ($RunTimePF, $GUI_UNCHECKED) GUICtrlSetState ($IPG, $GUI_UNCHECKED) GUICtrlSetData ($nIPG, '1') GUICtrlSetState ($Retry, $GUI_UNCHECKED) GUICtrlSetData ($nRetry, '3') GUICtrlSetState ($RetryTime, $GUI_UNCHECKED) GUICtrlSetData ($nRetryTime, '5') GUICtrlSetState ($RetryNet, $GUI_UNCHECKED) If $ResetClear Then GUICtrlSetData ($eXcludeFiles, '') If $ResetClear Then GUICtrlSetData ($eXcludeDirs, '') GUICtrlSetState ($CopyArchive, $GUI_UNCHECKED) GUICtrlSetState ($ResetArchive, $GUI_UNCHECKED) GUICtrlSetState ($eXcludeOld, $GUI_UNCHECKED) GUICtrlSetState ($eXcludeC, $GUI_UNCHECKED) GUICtrlSetState ($eXcludeE, $GUI_CHECKED) GUICtrlSetState ($eXcludeT, $GUI_UNCHECKED) GUICtrlSetState ($eXcludeO, $GUI_UNCHECKED) GUICtrlSetState ($eXcludeJ, $GUI_CHECKED) GUICtrlSetState ($minSize, $GUI_UNCHECKED) GUICtrlSetData ($minValue, '') GUICtrlSetData ($minMeasure, 'KB', 'KB') GUICtrlSetState ($MAXSize, $GUI_UNCHECKED) GUICtrlSetData ($MAXValue, '') GUICtrlSetData ($MAXMeasure, 'KB', 'KB') GUICtrlSetState ($minAge, $GUI_UNCHECKED) GUICtrlSetData ($minAgeDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($MAXAge, $GUI_UNCHECKED) GUICtrlSetData ($MAXAgeDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($MAXAccess, $GUI_UNCHECKED) GUICtrlSetData ($MAXAccessDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($minAccess, $GUI_UNCHECKED) GUICtrlSetData ($minAccessDate, @YEAR & '/' & @MON & '/' & @MDAY) GUICtrlSetState ($LOGTimeStamps, $GUI_UNCHECKED) GUICtrlSetState ($LOGFullPathnames, $GUI_UNCHECKED) GUICtrlSetState ($LOGFileSizes, $GUI_UNCHECKED) GUICtrlSetState ($LOGeta, $GUI_UNCHECKED) GUICtrlSetState ($jobLOG, $GUI_INDETERMINATE) GUICtrlSetState ($jobState, $GUI_INDETERMINATE) Return EndFunc ;-> fReset Func fLoadJobs($fJobsDir = '') If $fJobsDir = '' OR NOT FileExists ($fJobsDir) OR NOT FileExists ($fJobsDir & '\*.gjb') Then Return Dim $jobFilesList[1][3] = [[0]] $jobFiles = FileFindFirstFile ($fJobsDir & '\*.gjb') While 'jobExists' $jobFile = FileFindNextFile ($jobFiles) If @error Then ExitLoop IniReadSection ($fJobsDir & '\' & $jobFile, 'PATH_FILE') If @error Then ContinueLoop $jobSrcDir = IniRead ($fJobsDir & '\' & $jobFile, 'PATH_FILE', 'SrcDir', '') $jobDestDir = IniRead ($fJobsDir & '\' & $jobFile, 'PATH_FILE', 'DestDir', '') ReDim $jobFilesList[UBound($jobFilesList) + 1][3] $jobFilesList[0][0] = $jobFilesList[0][0] + 1 $jobFilesList[$jobFilesList[0][0]][0] = $jobFile $jobFilesList[$jobFilesList[0][0]][1] = $jobSrcDir $jobFilesList[$jobFilesList[0][0]][2] = $jobDestDir WEnd FileClose ($jobFiles) If $jobFilesList[0][0] > 1 Then $hy = 0 If $jobFilesList[0][0] > 5 Then $hy = 20 * ($jobFilesList[0][0] - 5) If $jobFilesList[0][0] > 10 Then $hy = 100 $GUIJobList = GUICreate ('RoboCopy - Robust File Copy Utility', 750, 170 + $hy, 25, 25, -1, $WS_EX_TOPMOST) $jobList = GUICtrlCreateListView ('RoboCopy Job|Source directory|Destination directory', 10, 10, 730, 125 + $hy, $LVS_REPORT + $LVS_SHOWSELALWAYS + $LVS_SINGLESEL + $LVS_NOSORTHEADER + $LVS_SORTASCENDING, $LVS_EX_FLATSB + $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE) GUICtrlSendMsg ($jobList, $LVM_SETCOLUMNWIDTH, 0, 150) GUICtrlSendMsg ($jobList, $LVM_SETCOLUMNWIDTH, 1, 275) GUICtrlSendMsg ($jobList, $LVM_SETCOLUMNWIDTH, 2, 275) For $i = 1 To $jobFilesList[0][0] Assign ('jobListItem' & $i, GUICtrlCreateListViewItem (StringTrimRight ($jobFilesList[$i][0], 4) & '|' & $jobFilesList[$i][1] & '|' & $jobFilesList[$i][2], $jobList), 0) Next $jobLoad = GUICtrlCreateButton ('Load', 585, 143 + $hy, 75, 22) GUICtrlSetTip ($jobLoad, 'Right click for more options', '', 0, 1) $jobLoadMenu = GUICtrlCreateContextMenu ($jobLoad) $jobLoadSingle = GUICtrlCreateMenuItem ('Load', $jobLoadMenu, 0, 1) $jobLoadAll = GUICtrlCreateMenuItem ('Load All', $jobLoadMenu, 1, 1) $jobLoadAdminSingle = GUICtrlCreateMenuItem ('Load as Administrator', $jobLoadMenu, 2, 1) $jobLoadAdminAll = GUICtrlCreateMenuItem ('Load All as Administrator', $jobLoadMenu, 3, 1) $jobStart = GUICtrlCreateButton ('Start', 665, 143 + $hy, 75, 22) GUICtrlSetTip ($jobStart, 'Right click for more options', '', 0, 1) $jobStartMenu = GUICtrlCreateContextMenu ($jobStart) $jobStartSingle = GUICtrlCreateMenuItem ('Start', $jobStartMenu, 0, 1) $jobStartAll = GUICtrlCreateMenuItem ('Start All', $jobStartMenu, 1, 1) $jobStartAdminSingle = GUICtrlCreateMenuItem ('Start as Administrator', $jobStartMenu, 2, 1) $jobStartAdminAll = GUICtrlCreateMenuItem ('Start All as Administrator', $jobStartMenu, 3, 1) If IsAdmin () Then ; ------------------------------------------------------------------------------------------------------------------------------------------------------ ; Ovo se radi iskljucivo zato sto se prilikom brisanja Control-a, recikliraju i svi ControlID-evi, dok vrijednosti svih varijabli ; koje su vezane uz tu Control-u ostaju nepromijenjene. Zato nam je izuzetno bitno rucno resetirati i vrijednosti svih varijabli. GUICtrlDelete ($jobLoadSingle) GUICtrlDelete ($jobLoadAll) GUICtrlDelete ($jobStartSingle) GUICtrlDelete ($jobStartAll) Dim $jobLoadSingle = Random (900, 999), $jobLoadAll = Random (900, 999), $jobStartSingle = Random (900, 999), $jobStartAll = Random (900, 999) ; ------------------------------------------------------------------------------------------------------------------------------------------------------ fButtonSetShield($jobLoad, True) GUICtrlSetData ($jobLoadAdminSingle, 'Load') GUICtrlSetData ($jobLoadAdminAll, 'Load All') GUICtrlSetState ($jobLoadAdminSingle, $GUI_CHECKED) fButtonSetShield($jobStart, True) GUICtrlSetData ($jobStartAdminSingle, 'Start') GUICtrlSetData ($jobStartAdminAll, 'Start All') GUICtrlSetState ($jobStartAdminSingle, $GUI_CHECKED) Else GUICtrlSetState ($jobLoadSingle, $GUI_CHECKED) GUICtrlSetState ($jobStartSingle, $GUI_CHECKED) EndIf Dim $jobProcessed = False GUISetState (@SW_SHOW, $GUIJobList) While 'JobList' $GUIState = GUIGetMsg () Select Case $GUIState = $jobLoadSingle OR $GUIState = $jobLoadAll OR $GUIState = $jobLoadAdminSingle OR $GUIState = $jobLoadAdminAll If $GUIState = $jobLoadSingle OR $GUIState = $jobLoadAll Then fButtonSetShield($jobLoad, False) If $GUIState = $jobLoadAdminSingle OR $GUIState = $jobLoadAdminAll Then fButtonSetShield($jobLoad, True) If $GUIState = $jobLoadSingle OR $GUIState = $jobLoadAdminSingle Then GUICtrlSetData ($jobLoad, 'Load') If $GUIState = $jobLoadAll OR $GUIState = $jobLoadAdminAll Then GUICtrlSetData ($jobLoad, 'Load All') Case $GUIState = $jobStartSingle OR $GUIState = $jobStartAll OR $GUIState = $jobStartAdminSingle OR $GUIState = $jobStartAdminAll If $GUIState = $jobStartSingle OR $GUIState = $jobStartAll Then fButtonSetShield($jobStart, False) If $GUIState = $jobStartAdminSingle OR $GUIState = $jobStartAdminAll Then fButtonSetShield($jobStart, True) If $GUIState = $jobStartSingle OR $GUIState = $jobStartAdminSingle Then GUICtrlSetData ($jobStart, 'Start') If $GUIState = $jobStartAll OR $GUIState = $jobStartAdminAll Then GUICtrlSetData ($jobStart, 'Start All') Case $GUIState = $jobLoad OR $GUIState = $jobStart $jobProcessAll = False If $GUIState = $jobLoad AND (BitAnd (GUICtrlRead ($jobLoadAll), $GUI_CHECKED) OR BitAnd (GUICtrlRead ($jobLoadAdminAll), $GUI_CHECKED)) Then $jobProcessAll = True If $GUIState = $jobStart AND (BitAnd (GUICtrlRead ($jobStartAll), $GUI_CHECKED) OR BitAnd (GUICtrlRead ($jobStartAdminAll), $GUI_CHECKED)) Then $jobProcessAll = True If NOT $jobProcessAll Then $SelectedJobListItem = GUICtrlRead (GUICtrlRead ($jobList)) If $SelectedJobListItem = '' Then ContinueLoop If StringLeft ($SelectedJobListItem, 1) = '|' Then $SelectedJobListItem = StringTrimLeft ($SelectedJobListItem, 1) If StringRight ($SelectedJobListItem, 1) = '|' Then $SelectedJobListItem = StringTrimRight ($SelectedJobListItem, 1) $SelectedJobListItem = StringSplit ($SelectedJobListItem, '|') If NOT FileExists ($fJobsDir & '\' & $SelectedJobListItem[1] & '.gjb') Then ContinueLoop If $GUIState = $jobLoad Then If NOT IsAdmin () AND BitAnd (GUICtrlRead ($jobLoadAdminSingle), $GUI_CHECKED) Then ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $SelectedJobListItem[1] & '.gjb"', @ScriptDir, 'runas') Else ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $SelectedJobListItem[1] & '.gjb"', @ScriptDir, 'open') EndIf EndIf If $GUIState = $jobStart Then If NOT IsAdmin () AND BitAnd (GUICtrlRead ($jobStartAdminSingle), $GUI_CHECKED) Then ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $SelectedJobListItem[1] & '.gjb" /start', @ScriptDir, 'runas') Else ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $SelectedJobListItem[1] & '.gjb" /start', @ScriptDir, 'open') EndIf EndIf Else GUISetState (@SW_HIDE, $GUIJobList) For $i = 1 To $jobFilesList[0][0] If NOT FileExists ($fJobsDir & '\' & $jobFilesList[$i][0]) Then ContinueLoop If $GUIState = $jobLoad Then If NOT IsAdmin () AND BitAnd (GUICtrlRead ($jobLoadAdminAll), $GUI_CHECKED) Then ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $jobFilesList[$i][0] & '"', @ScriptDir, 'runas') Else ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $jobFilesList[$i][0] & '"', @ScriptDir, 'open') EndIf EndIf If $GUIState = $jobStart Then If NOT IsAdmin () AND BitAnd (GUICtrlRead ($jobStartAdminAll), $GUI_CHECKED) Then ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $jobFilesList[$i][0] & '" /start', @ScriptDir, 'runas') Else ShellExecute (@ScriptFullPath, '/job:"' & $fJobsDir & '\' & $jobFilesList[$i][0] & '" /start', @ScriptDir, 'open') EndIf EndIf Next EndIf GUICtrlSetState ($jobList, $GUI_FOCUS) WinActivate ($GUIJobList) $jobProcessed = True If $jobProcessAll Then ExitLoop Case $GUIState = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete ($GUIJobList) If $jobProcessed Then Exit Else Dim $T_JobLoadFile = $jobFilesList[1][0], $T_JobLoad = True EndIf Return EndFunc ;-> fLoadJobs Func fButtonSetShield($hWnd, $lParam = False) ;To use values specified you must #include If NOT IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Local $aResult = DllCall ('user32.dll', 'lresult', 'SendMessageW', 'hwnd', $hWnd, 'uint', $BCM_SETSHIELD, 'wparam', 0, 'lparam', $lParam) If @error Then Return SetError (@error, @extended, '') Return $aResult[0] EndFunc ;-> fButtonSetShield Func fDisplayHelp($ParentGUI = '') MsgBox (262208, 'RoboCopy', @ScriptName & ' [/job:""] [/start] [/exit]' & @CRLF & @CRLF & '/job:""' & @TAB & '... load RoboCopy Job' & @CRLF & '/start' & @TAB & @TAB & @TAB & '... execute loaded RoboCopy Job' & @CRLF & '/exit' & @TAB & @TAB & @TAB & '... exit after the Job has finished', 0, $ParentGUI) Return SetError (0, 0, True) EndFunc ;-> fDisplayHelp Func fGUIOpen() ProcessClose ($RoboCopyPID) ProcessWaitClose ($RoboCopyPID, 5) $ProcessStop = 1 EndFunc ;-> fGUIOpen