;# modified 17/5/2017 12:36 #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=Backup.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region #### AutoIt Includes #### #include #include #include #include #include #include #include #include #include #EndRegion #### AutoIt Includes #### #Region ### Globals #### ; set the constant values for the array elements Global Enum _ $e_MAINGUI, _ $e_BACKUPDESTINATIONLBL, _ $e_INCLUDEMORELBL, _ $e_EXCLUDEAVTYPECHK, _ $e_EDITBOX, _ $e_COMPRESSBACKUPCHK, _ $e_BACKUPBTN, _ $e_ARRAYMAX ; create a global array for the controls Global $aid_Controls[$e_ARRAYMAX] #EndRegion ### Globals #### GUI_Draw() ; draw the gui ; check for interrupted copy Backup_CheckForPending() While 1 Sleep(20) WEnd Func Backup_CheckForPending() ; check if a backup or compression was interrupted Local $i_ResumeBackup = IsBackupRunning() Local $i_ResumeCompress = IsCompressRunning() ; if backup or compression failed If $i_ResumeBackup Or $i_ResumeCompress Then ; prompt the user to resume copy If MsgBox(BitOR($MB_ICONQUESTION, $MB_YESNO), _ 'Alert', _ 'A previous copy seems pending or was interupted ' & @CRLF & _ 'Select Yes to resume copying, No to skip') = $IDYES Then ; try to resume interrupted backup Backup_Resume($i_ResumeBackup, $i_ResumeCompress) Else ; user chose not to resume backup INI_Update('BackupRunning') ; delete the backup running indicator INI_Update(Default, Default, 'Pending') ; delete the pending section EndIf EndIf EndFunc ;==>Backup_CheckForPending Func Backup_CompressFiles($s_SourceFolder) _FileWriteLog(Log_ReturnPath(), 'Compression' & ' ..............Started ') ; update the ini to tell it that compression is running (checked if backup interrupted) INI_Update('CompressRunning', 1) Local $s_7zip = @TempDir & '\7zip' ; create a temp folder for the 7zip files If Not FileExists($s_7zip) Then _FileWriteLog(Log_ReturnPath(), '...Creating temp directory (' & DirCreate($s_7zip) & ')') ; copy the 7zip files to the created directory _FileWriteLog(Log_ReturnPath(), '...Installing 7za.exe (' & FileInstall('Tools\7za.exe', $s_7zip & '\7za.exe', $FC_OVERWRITE) & ')') _FileWriteLog(Log_ReturnPath(), '...Installing 7zCon.sfx (' & FileInstall('Tools\7zCon.sfx', $s_7zip & '\7zCon.sfx', $FC_OVERWRITE) & ')') GUICtrlSetData($aid_Controls[$e_EDITBOX], @CRLF, 1) GUICtrlSetData($aid_Controls[$e_EDITBOX], 'Compressing Backup' & @CRLF, 1) ; set the run command for 7za.exe Local $s_Command = $s_7zip & '\7za.exe a -r -y -sfx7zCon.sfx ' & _ '"' & CompressFile_ReturnPath() & '" ' & _ '"' & $s_SourceFolder & '\*' & '"' _FileWriteLog(Log_ReturnPath(), '...Command Line: ' & $s_Command) _FileWriteLog(Log_ReturnPath(), '') _FileWriteLog(Log_ReturnPath(), '#### 7-Zip Output Start ##############################################################################') ; run 7za.exe and get the console output. (Doesn't return output until 7za.exe has finished) Local $i_PID = Run($s_Command, '', '', $STDERR_MERGED) ProcessWaitClose($i_PID) ; split the console output for writing Local $as_Console = StringSplit(StdoutRead($i_PID), @LF) ; loop through the console output and write to the log and edit control For $i = 1 To $as_Console[0] _FileWriteLog(Log_ReturnPath(), $as_Console[$i]) GUICtrlSetData($aid_Controls[$e_EDITBOX], $as_Console[$i] & @CRLF, 1) Next _FileWriteLog(Log_ReturnPath(), '#### 7-Zip Output Finish #############################################################################') _FileWriteLog(Log_ReturnPath(), '') _FileWriteLog(Log_ReturnPath(), 'Removing 7Zip temp directory (' & DirRemove($s_7zip, 1) & ')') _FileWriteLog(Log_ReturnPath(), 'Removing Backup files temp directory (' & DirRemove($s_SourceFolder, 1) & ')') ; check that the backup.exe file has been created If FileExists(GUICtrlRead($aid_Controls[$e_BACKUPDESTINATIONLBL]) & '\Backup.exe') Then GUICtrlSetData($aid_Controls[$e_EDITBOX], '---> Compress Data backup Complete' & @CRLF, 1) _FileWriteLog(Log_ReturnPath(), 'Compression' & ' ..............Completed') Else GUICtrlSetData($aid_Controls[$e_EDITBOX], '---> Compress Data backup Complete' & @CRLF, 1) _FileWriteLog(Log_ReturnPath(), 'Compression' & ' ..............Failed') EndIf EndFunc ;==>Backup_CompressFiles Func Backup_CopyFiles($as_Source, $s_Destination) ; the passed value was not an array of files If Not IsArray($as_Source) Then ; if backup was completed there will be no files in the pending ; section. Check and remove the backuprunning indicator from the ini If IsBackupRunning() Then Return SetError(0, INI_Update('BackupRunning')) ; fresh backup or resuming an interrupted backup so file list required for function Return SetError(1, 0, _FileWriteLog(Log_ReturnPath(), '#ERROR# No files were selected for backup')) EndIf GUICtrlSetData($aid_Controls[$e_EDITBOX], '') ; clear the edit box Local $s_Mask = '*', _ ; initial mask for FLTAR search $s_Info = '', _ ; string for edit box updating $s_Source = '', _ ; string for the sourcefile path $s_DestinationFile = '', _ $s_FolderName = '' ; update the mask to exclude video files If GUICtrlRead($aid_Controls[$e_EXCLUDEAVTYPECHK]) = $GUI_CHECKED Then $s_Mask = '*|*.mp3;*.mp4;*.vob;*.mpeg|' Local $i_CopyErrors = 0, _ ; error counter for file copy $i_TotalErrors = 0 ; error counter for failed $as_Source copies Local $as_FLTAR = 0 ; array for files ; set the indicator signifies backup is running INI_Update('BackupRunning', 1) Return ; loop through the selected folders For $i = 1 To $as_Source[0][0] $i_CopyErrors = 0 ; reset the error counter $s_FolderName = $as_Source[$i][0] ; source folder name (i.e Desktop) $s_Source = $as_Source[$i][1] ; set the source file path _FileWriteLog(Log_ReturnPath(), $s_Source & ' ..............Started ') ; update the edit box GUICtrlSetData($aid_Controls[$e_EDITBOX], @CRLF & 'Backing Up ' & $s_FolderName & ' Folder' & @CRLF, ' ') ; get a list of files and folders in the specified folder $as_FLTAR = _FileListToArrayRec($s_Source, $s_Mask, $FLTAR_FILESFOLDERS, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH) If @error Then _FileWriteLog(Log_ReturnPath(), '#ERROR# Unable to read files to array') ContinueLoop ; #### will need changing to delete ini section if no files found #### EndIf #Region copy files and folder #### ; loop through the files\folders For $j = 1 To $as_FLTAR[0] ; replace the source path with the destination path $s_DestinationFile = StringReplace($as_FLTAR[$j], $s_Source, $s_Destination & '\' & $s_FolderName) ; check if path is a directory If _WinAPI_PathIsDirectory($as_FLTAR[$j]) Then ; check if the directory is empty If _WinAPI_PathIsDirectoryEmpty($as_FLTAR[$j]) Then ; if the empty folder exists, skip it If FileExists($s_DestinationFile) Then ContinueLoop ; copy the directory If Not DirCopy($as_FLTAR[$j], _ ; source $s_DestinationFile, _ ; destination $FC_OVERWRITE) _ ; overwrite existing files Then $i_CopyErrors += 1 ; increase the copy error count EndIf Else ; path is a file ; if we're resuming a copy but the file exists skip it If FileExists($s_DestinationFile) And FileGetSize($as_FLTAR[$j]) = FileGetSize($s_DestinationFile) Then ContinueLoop ; check for the parent directory of the file If Not FileExists(StringRegExpReplace($s_DestinationFile, "\\[^\\]*$", "")) Then _ _WinAPI_ShellCreateDirectory(StringRegExpReplace($s_DestinationFile, "\\[^\\]*$", "")) ; copy the file and log any errors If Not _WinAPI_CopyFileEx($as_FLTAR[$j], $s_DestinationFile) Then _FileWriteLog(Log_ReturnPath(), '#ERROR# Failed to copy ' & $as_FLTAR[$j] & ' (' & _WinAPI_GetLastErrorMessage() & ')') $i_CopyErrors += 1 EndIf EndIf Next #EndRegion copy files and folder #### ; delete the copied folder entry If Not $i_CopyErrors Then ; no errors during the copy process INI_Update($s_FolderName, Default, 'Pending') ; delete the folder from the pending section $s_Info = $s_FolderName & ' backup Complete' Else ; DOH! errors $s_Info = $s_FolderName & ' backup failed. Check the log' $i_TotalErrors += 1 EndIf _FileWriteLog(Log_ReturnPath(), $s_Source & ' ..............Completed ') ; update the edit box GUICtrlSetData($aid_Controls[$e_EDITBOX], '', ' ') GUICtrlSetData($aid_Controls[$e_EDITBOX], '---> ' & $s_Info & @CRLF, ' ') Sleep(10) Next ; update the edit box GUICtrlSetData($aid_Controls[$e_EDITBOX], @CRLF, ' ') GUICtrlSetData($aid_Controls[$e_EDITBOX], '#### All Folder backup jobs completed ####' & @CRLF, ' ') ; if there's no dirs in the pending section, assume backup has completed and deleted the indicator If Not IsArray(IniReadSection(INI_ReturnPath(), 'Pending')) Then INI_Update('BackupRunning') ; set @error to the number of errors Return SetError($i_TotalErrors) EndFunc ;==>Backup_CopyFiles Func Backup_GetFolderArray() Local $i_Folders = 4 ; set the number of folders in the array ; create a 2D array with the default folders info Local $as_Source[$i_Folders + 1][2] = _ [[$i_Folders, ''], _ ['Desktop', Desktop_ReturnPath()], _ ['Favorites', Favorites_ReturnPath()], _ ['Firefox', Firefox_ReturnPath()], _ ['MyDocuments', MyDocuments_ReturnPath()]] ; get the extra folders from the label If GUICtrlRead($aid_Controls[$e_INCLUDEMORELBL]) Then ; extra folders to copy Local $as_MoreFolders = StringSplit(GUICtrlRead($aid_Controls[$e_INCLUDEMORELBL]), '|') ; split the folders ; calculate the new number of folders Local $i_FolderCount = $i_Folders + $as_MoreFolders[0] ; resize the array to accept the new folders ReDim $as_Source[$i_FolderCount + 1][2] ; update the folder count $as_Source[0][0] = $i_FolderCount ; loop through the new folder list and add the info to the array For $i = 1 To $as_MoreFolders[0] $as_Source[$i_Folders + $i][0] = _StringTitleCase(StringRegExpReplace($as_MoreFolders[$i], "^.*\\|\..*$", "")) ; get the last folder name from the source $as_Source[$i_Folders + $i][1] = $as_MoreFolders[$i] ; source folders Next EndIf ; return an array of default folders and user selected ones Return $as_Source EndFunc ;==>Backup_GetFolderArray Func Backup_Resume($b_ResumeBackup, $b_ResumeCompress) ; always start with a fresh log If FileExists(Log_ReturnPath()) Then FileDelete(Log_ReturnPath()) _FileWriteLog(Log_ReturnPath(), 'Resuming previously interrupted backup...') ; get the destination path from the ini Local $s_Destination = Destination_ReturnPath() Local $s_TrayMsg = 'Your Backup was successful' ; resume backup if selected If $b_ResumeBackup Then Backup_CopyFiles(IniReadSection(INI_ReturnPath(), 'Pending'), $s_Destination) If @error Then $s_TrayMsg = 'Errors occured backing up ' & @error & ' folder(s)' EndIf ; resume compression if selected If $b_ResumeCompress Or GUICtrlRead($aid_Controls[$e_COMPRESSBACKUPCHK]) = 1 Then Backup_CompressFiles($s_Destination) If @error Then $s_TrayMsg = 'Errors occured compressing the files' EndIf TrayTip("Backup Completed", $s_TrayMsg, 10, $TIP_ICONASTERISK) EndFunc ;==>Backup_Resume Func Backup_Run() ; always start with a fresh log If FileExists(Log_ReturnPath()) Then FileDelete(Log_ReturnPath()) ; get an array of the selected folders (no need for IsArray() check as array is always returned) Local $as_Source = Backup_GetFolderArray() ; Write the folder list to the ini. We need to do this before the copy as if the program crashes ; not all the folders may have been written to the ini file For $i = 1 To $as_Source[0][0] $s_Folder = $as_Source[$i][0] ; update folder name $s_Source = $as_Source[$i][1] ; update the source $s_Destination = Destination_ReturnPath() ; update the destination ; write the folder paths to the ini, needed if program terminates INI_Update($s_Folder, _ ; key (folder) $s_Source, _ ; value (source folders 'Pending') ; section Next ; copy the selected files Backup_CopyFiles($as_Source, $s_Destination) If @error Then Return TrayTip('Backup Completed', 'Errors occured backing up ' & @error & ' folder(s)', 10, $TIP_ICONHAND) ; if compress backup is checked, The folder containing the files exists and isn't empy then compress the files If GUICtrlRead($aid_Controls[$e_COMPRESSBACKUPCHK]) = 1 And FileExists($s_Destination) And DirGetSize($s_Destination) > 0 Then Backup_CompressFiles($s_Destination) If @error Then Return TrayTip('Backup Completed', 'Errors occured compressing the files', 10, $TIP_ICONHAND) TrayTip("Backup Completed", "Your Backup was successful", 10, $TIP_ICONASTERISK) EndFunc ;==>Backup_Run Func Folder_BrowseForDestination() Local $s_Destination = FileSelectFolder('Select backup destination', '', $FSF_CREATEBUTTON + $FSF_NEWDIALOG + $FSF_EDITCONTROL) If @error Then ; user cancelled ; disable the backup button if no destination is selected If GUICtrlRead($aid_Controls[$e_BACKUPDESTINATIONLBL]) = '' Then GUICtrlSetState($aid_Controls[$e_BACKUPBTN], $GUI_DISABLE) Return EndIf ; enable the backup button GUICtrlSetState($aid_Controls[$e_BACKUPBTN], $GUI_ENABLE) ; update the label and the ini GUICtrlSetData($aid_Controls[$e_BACKUPDESTINATIONLBL], $s_Destination) If GUICtrlRead($aid_Controls[$e_COMPRESSBACKUPCHK]) = 1 Then INI_Update('CompressFile', $s_Destination & '\Backup.exe') Else INI_Update('Destination', $s_Destination) EndIf ; get the type of destination drive selected Local $s_DrvType = DriveGetType($s_Destination) ; set a default message for the edit box Local $s_Message = 'The Drive you selected is Local.' & @CRLF & _ 'Please make sure you have plenty of space before proceeding with Backup' ; change message based on drive selection If $s_DrvType = 'Removable' Then $s_Message = 'The Drive you selected is an External one.' & @CRLF & _ ' This is against AON policy to copy data to external drives,' & @CRLF & _ ' tool will not be held responsible for not adhering AON policies' & @CRLF ElseIf $s_DrvType = 'Network' Then $s_Message = 'The Drive you selected is on Network.' & @CRLF & _ 'Please make sure you have plenty of space before proceeding with Backup' EndIf ; update the edit control GUICtrlSetData($aid_Controls[$e_EDITBOX], ' ') GUICtrlSetData($aid_Controls[$e_EDITBOX], $s_Message, 1) EndFunc ;==>Folder_BrowseForDestination Func Folder_BrowseForMore() ; read the old selection from the label Local $s_OldSelection = GUICtrlRead($aid_Controls[$e_INCLUDEMORELBL]) ; get any new selections from the user Local $s_Selection = FileSelectFolder('Select folders to backup', '', $FSF_CREATEBUTTON + $FSF_NEWDIALOG + $FSF_EDITCONTROL) If @error Then Return ; combine the old and new selections $s_Selection = $s_OldSelection & '|' & $s_Selection ; trim any leading pipe symbols from the string and update the label GUICtrlSetData($aid_Controls[$e_INCLUDEMORELBL], StringRegExpReplace($s_Selection, '\A[\|]+', '')) EndFunc ;==>Folder_BrowseForMore Func GUI_Draw() Opt('GUIOnEventMode', 1) $aid_Controls[$e_MAINGUI] = GUICreate('Backup', 627, 384) GUISetOnEvent($GUI_EVENT_CLOSE, 'Program_Exit') ; set the font properties for the text Local $i_FontSize = 11 Local $i_FontWeight = 400 Local $s_FontName = 'Lucida Console' #Region #### Backup controls #### GUICtrlCreateLabel('Backup Destination:', 4, 12, 175, 19, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) $aid_Controls[$e_BACKUPDESTINATIONLBL] = GUICtrlCreateLabel('', 175, 11, 353, 21, BitOR($SS_SUNKEN, $DT_END_ELLIPSIS), $WS_EX_STATICEDGE) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetBkColor(-1, $COLOR_WHITE) GUICtrlCreateButton('Browse', 540, 10, 75, 25) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, 0, $s_FontName) GUICtrlSetOnEvent(-1, 'Folder_BrowseForDestination') #EndRegion #### Backup controls #### #Region #### Include More controls #### GUICtrlCreateLabel('Include More :', 14, 51, 130, 19) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) $aid_Controls[$e_INCLUDEMORELBL] = GUICtrlCreateLabel('', 175, 48, 353, 21, BitOR($SS_SUNKEN, $DT_END_ELLIPSIS), $WS_EX_STATICEDGE) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetBkColor(-1, $COLOR_WHITE) GUICtrlCreateButton('Browse', 540, 48, 75, 25) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetOnEvent(-1, 'Folder_BrowseForMore') #EndRegion #### Include More controls #### $aid_Controls[$e_EXCLUDEAVTYPECHK] = GUICtrlCreateCheckbox('Exclude Audio/Video file types', 16, 128, 445, 17) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetOnEvent(-1, 'ExcludeAV_Clicked') $aid_Controls[$e_EDITBOX] = GUICtrlCreateEdit('', 4, 160, 613, 185) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, $COLOR_BLACK) $aid_Controls[$e_BACKUPBTN] = GUICtrlCreateButton('Backup', 454, 352, 75, 25) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetOnEvent(-1, 'Backup_Run') GUICtrlCreateButton('Exit', 536, 352, 75, 25) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetOnEvent(-1, 'Program_Exit') $aid_Controls[$e_COMPRESSBACKUPCHK] = GUICtrlCreateCheckbox('Compress Backup', 16, 356, 157, 17) GUICtrlSetFont(-1, $i_FontSize, $i_FontWeight, $GUI_FONTNORMAL, $s_FontName) GUICtrlSetOnEvent(-1, 'CompressBackup_Clicked') GUICtrlSetTip(-1, 'Use to compress data') GUI_LoadOptions() ; load the control states GUISetState() ; show the main gui EndFunc ;==>GUI_Draw Func GUI_LoadOptions() ; set the checkbox states GUICtrlSetState($aid_Controls[$e_EXCLUDEAVTYPECHK], Number(IniRead(INI_ReturnPath(), 'Backup', 'ExcludeAV', $GUI_UNCHECKED))) Local $i_State = Number(IniRead(INI_ReturnPath(), 'Backup', 'CompressBackup', $GUI_UNCHECKED)) GUICtrlSetState($aid_Controls[$e_COMPRESSBACKUPCHK], $i_State) If $i_State = $GUI_CHECKED Then CompressBackup_Clicked() EndFunc ;==>GUI_LoadOptions Func INI_Update($s_Key = Default, $v_Value = Default, $s_Section = 'Backup') ; if no key supplied then assume section to be deleted If $s_Key = Default Then Return IniDelete(INI_ReturnPath(), $s_Section) ; if no value supplied then assume key to be deleted If $v_Value = Default Then Return IniDelete(INI_ReturnPath(), $s_Section, $s_Key) ; update the ini key and value Return IniWrite(INI_ReturnPath(), $s_Section, $s_Key, $v_Value) EndFunc ;==>INI_Update Func Program_Exit() _FileWriteLog(Log_ReturnPath(), 'Updating INI ' & _ '(' & INI_Update('BackupRunning') & ')' & _ ; remove the BackupRunning key\value '(' & INI_Update('CompressFile') & ')' & _ ; remove the compressfile key\value '(' & INI_Update('CompressRunning') & ')' & _ ; remove the CompressRunning key\value '(' & INI_Update('Destination') & ')' & _ ; remove the Destination key\value '(' & INI_Update(Default, Default, 'Pending') & ')') ; remove the Pending section GUIDelete() Exit EndFunc ;==>Program_Exit #Region #### Checkbox Functions #### Func ExcludeAV_Clicked() ; update the ini with the checkbox state INI_Update('ExcludeAV', GUICtrlRead($aid_Controls[$e_EXCLUDEAVTYPECHK])) EndFunc ;==>ExcludeAV_Clicked Func CompressBackup_Clicked() ; get the state of the compress chkbox Local $i_State = GUICtrlRead($aid_Controls[$e_COMPRESSBACKUPCHK]) ; get any selected destination Local $s_Destination = GUICtrlRead($aid_Controls[$e_BACKUPDESTINATIONLBL]) ; update the ini with the checkbox state INI_Update('CompressBackup', $i_State) ; check compress state If $i_State = 4 Then ; unchecked ; delete the compress files destination INI_Update('CompressFile') ; check if a destination has been selected If $s_Destination Then ; yes ; change temp destination to the user selected one INI_Update('Destination', $s_Destination) Else ; no ; delete the destination key from the ini INI_Update('Destination') EndIf Else ; checked ; if there are no backup operations pending, update the temp path for the file copy If Not IsBackupRunning() And Not IsCompressRunning() Then INI_Update('Destination', TempDir_ReturnUniquePath()) ; destination is selected so update the value (this is the file path for the final compressed exe If $s_Destination Then Return INI_Update('CompressFile', $s_Destination & '\Backup.exe') ; delete the compress files destination If Not IsBackupRunning() And Not IsCompressRunning() Then INI_Update('CompressFile') EndIf EndFunc ;==>CompressBackup_Clicked #EndRegion #### Checkbox Functions #### #Region #### Return Value Functions #### Func IsBackupRunning() Return Number(IniRead(INI_ReturnPath(), 'Backup', 'BackupRunning', 0)) EndFunc ;==>IsBackupRunning Func IsCompressRunning() Return Number(IniRead(INI_ReturnPath(), 'Backup', 'CompressRunning', 0)) EndFunc ;==>IsCompressRunning Func CompressFile_ReturnPath() Return IniRead(INI_ReturnPath(), 'Backup', 'CompressFile', @DesktopDir & '\Backup.exe') EndFunc ;==>CompressFile_ReturnPath Func Desktop_ReturnPath() Return @DesktopDir EndFunc ;==>Desktop_ReturnPath Func Destination_ReturnPath() Return IniRead(INI_ReturnPath(), 'Backup', 'Destination', '') EndFunc ;==>Destination_ReturnPath Func Favorites_ReturnPath() Return @UserProfileDir & '\Favorites' EndFunc ;==>Favorites_ReturnPath Func Firefox_ReturnPath() Return @AppDataDir & '\Mozilla' EndFunc ;==>Firefox_ReturnPath Func INI_ReturnPath() Return @ScriptDir & '\CurrentDir.ini' EndFunc ;==>INI_ReturnPath Func Log_ReturnPath() Return '.\Backup.log' EndFunc ;==>Log_ReturnPath Func MyDocuments_ReturnPath() Return @MyDocumentsDir EndFunc ;==>MyDocuments_ReturnPath Func TempDir_ReturnUniquePath() ; create a unique temp folder name and trim any trailing periods Return StringRegExpReplace(_TempFile(@TempDir, '', ''), '[\.]\Z', '') EndFunc ;==>TempDir_ReturnUniquePath #EndRegion #### Return Value Functions ####