mr-es335 Posted Saturday at 09:20 PM Posted Saturday at 09:20 PM (edited) Good day, I have been attempting to position a progress indicator somewhere in the following script...but have been unsuccessful in my attempts. Any assistance here would, as always , be greatly appreciated! Spoiler expandcollapse popup; ----------------------------------------------- ; 9/16/2026 2:30:06 PM ; ----------------------------------------------- #include <ExtMsgBox.au3> #include <FileConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) ; ----------------------------------------------- ;~ BackupRestore(True) BackupRestore(False) ; ----------------------------------------------- Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sDrive, $sRelativePath, $iResult Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure 2_GR5! " Local $sBaseBackupDir = "E:\Backups\App_Install\2_GR5\SourceData" ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; ----------------------------------------------- Local $aData[] = [ _ "C:\Users\Public\Public Desktop\Guitar Rig 5.lnk", _ "C:\Windows\System32\msvcp120.dll", _ "C:\Windows\System32\msvcr120.dll", _ "C:\Windows\SysWOW64\msvcp120.dll", _ "C:\Windows\SysWOW64\msvcr120.dll", _ "C:\Program Files\Common Files\Native Instruments", _ "C:\Program Files\Native Instruments", _ "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Native Instruments", _ "C:\Users\RML_User\AppData\Local\Native Instruments", _ "E:\Text\Native Instruments"] ; ----------------------------------------------- For $i = 0 To UBound($aData) - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath ; ----------------------------------------------- If $bIsBackup Then ; === Backup Logic (Src to Dst) === If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) ContinueLoop EndIf ; ----------------------------------------------- If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) Else $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) ;~ ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) EndIf ; ----------------- Else ; === Restore Logic (Swap Dest and Src) === ; ----------------------------------------------- If StringInStr(FileGetAttrib($sDst), "D") Then $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) Else $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) EndIf EndIf Next ; ----------------------------------------------- Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure 2_GR5 has completed! " ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) EndFunc ;==>BackupRestore ; ----------------------------------------------- Edited Saturday at 09:20 PM by mr-es335 mr-es335 Sentinel Music Studios
Solution donnyh13 Posted Sunday at 02:55 PM Solution Posted Sunday at 02:55 PM (edited) Since you don't have a GUI, I'm assuming some ConsoleWrites will suffice? If so, here is one option. Nothing too fancy. expandcollapse popup; ----------------------------------------------- ; 9/16/2026 2:30:06 PM ; ----------------------------------------------- #include <ExtMsgBox.au3> #include <FileConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) ; ----------------------------------------------- ;~ BackupRestore(True) BackupRestore(False) ; ----------------------------------------------- Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sDrive, $sRelativePath, $iResult Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure 2_GR5! " Local $sBaseBackupDir = "E:\Backups\App_Install\2_GR5\SourceData" ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; ----------------------------------------------- Local $aData[] = [ _ "C:\Users\Public\Public Desktop\Guitar Rig 5.lnk", _ "C:\Windows\System32\msvcp120.dll", _ "C:\Windows\System32\msvcr120.dll", _ "C:\Windows\SysWOW64\msvcp120.dll", _ "C:\Windows\SysWOW64\msvcr120.dll", _ "C:\Program Files\Common Files\Native Instruments", _ "C:\Program Files\Native Instruments", _ "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Native Instruments", _ "C:\Users\RML_User\AppData\Local\Native Instruments", _ "E:\Text\Native Instruments"] ; ---------------------------------------------- Local $sProgress, $sProcedure = ($bIsBackup) ? ("Backing up ") : ("Restoring ") Local $iTotal = UBound($aData) ; ----------------------------------------------- For $i = 0 To UBound($aData) - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath $sProgress = "" ; Overwrite any former messages to begin again. ; ----------------------------------------------- If $bIsBackup Then ; === Backup Logic (Src to Dst) === If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) ConsoleWrite("> Skip: " & $i & " of " & $iTotal & " " & $sProcedure & " -- source file does not exist -- skipping file: " & $sSrc & @CRLF) ContinueLoop EndIf ; ----------------------------------------------- If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) $sProgress &= " File: " & $sSrc & " ==> " & $sDst ;~ ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) Else $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) $sProgress &= " Folder: " & $sSrc & " ==> " & $sDst ;~ ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) EndIf ; ----------------- Else ; === Restore Logic (Swap Dest and Src) === ; ----------------------------------------------- If StringInStr(FileGetAttrib($sDst), "D") Then $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) $sProgress &= " Folder: " & $sDst & " ==> " & $sSrc ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) Else $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) $sProgress &= " File: " & $sDst & " ==> " & $sSrc ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) EndIf EndIf If ($iResult = 1) Then ; Success ConsoleWrite("+ " & $i & " of " & $iTotal & " Success: " & $sProcedure & $sProgress & @CRLF) Else ; Fail ConsoleWrite("! " & $i & " of " & $iTotal & " Fail: " & $sProcedure & $sProgress & @CRLF) EndIf Next ; ----------------------------------------------- Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure 2_GR5 has completed! " ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) EndFunc ;==>BackupRestore ; ----------------------------------------------- Edited Sunday at 02:56 PM by donnyh13 mr-es335 1 LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
mr-es335 Posted Sunday at 10:15 PM Author Posted Sunday at 10:15 PM donnyh13, Thanks for the sampling. Is there any way to employ MsgBox's for the ConsoleWrites? mr-es335 Sentinel Music Studios
donnyh13 Posted Sunday at 10:33 PM Posted Sunday at 10:33 PM (edited) Yup, It would be a simple direct replacement, besides the starting symbols (">,!,+"), this should work. With extended message boxes, I suppose you could make different icons appear for errors/skips, I haven't used that UDF before, so I don't have any experience with toying with the settings, so you may wish to do that part. expandcollapse popup; ----------------------------------------------- ; 9/16/2026 2:30:06 PM ; ----------------------------------------------- #include <ExtMsgBox.au3> #include <FileConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) ; ----------------------------------------------- ;~ BackupRestore(True) BackupRestore(False) ; ----------------------------------------------- Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sDrive, $sRelativePath, $iResult Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure 2_GR5! " Local $sBaseBackupDir = "E:\Backups\App_Install\2_GR5\SourceData" ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; ----------------------------------------------- Local $aData[] = [ _ "C:\Users\Public\Public Desktop\Guitar Rig 5.lnk", _ "C:\Windows\System32\msvcp120.dll", _ "C:\Windows\System32\msvcr120.dll", _ "C:\Windows\SysWOW64\msvcp120.dll", _ "C:\Windows\SysWOW64\msvcr120.dll", _ "C:\Program Files\Common Files\Native Instruments", _ "C:\Program Files\Native Instruments", _ "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Native Instruments", _ "C:\Users\RML_User\AppData\Local\Native Instruments", _ "E:\Text\Native Instruments"] ; ---------------------------------------------- Local $sProgress, $sProcedure = ($bIsBackup) ? ("Backing up ") : ("Restoring ") Local $iTotal = UBound($aData) ; ----------------------------------------------- For $i = 0 To UBound($aData) - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath $sProgress = "" ; Overwrite any former messages to begin again. ; ----------------------------------------------- If $bIsBackup Then ; === Backup Logic (Src to Dst) === If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) _ExtMsgBox(64, " ", " Skipping!", $i & " of " & $iTotal & " " & $sProcedure & " -- source file does not exist -- skipping file: " & $sSrc, 2) ;~ ConsoleWrite("> Skip: " & $i & " of " & $iTotal & " " & $sProcedure & " -- source file does not exist -- skipping file: " & $sSrc & @CRLF) ContinueLoop EndIf ; ----------------------------------------------- If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) $sProgress &= " File: " & $sSrc & " ==> " & $sDst ;~ ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) Else $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) $sProgress &= " Folder: " & $sSrc & " ==> " & $sDst ;~ ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) EndIf ; ----------------- Else ; === Restore Logic (Swap Dest and Src) === ; ----------------------------------------------- If StringInStr(FileGetAttrib($sDst), "D") Then $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) $sProgress &= " Folder: " & $sDst & " ==> " & $sSrc ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) Else $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) $sProgress &= " File: " & $sDst & " ==> " & $sSrc ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) EndIf EndIf If ($iResult = 1) Then ; Success _ExtMsgBox(64, " ", " Success!", $i & " of " & $iTotal & " -- " & $sProcedure & $sProgress, 2) ;~ ConsoleWrite("+ " & $i & " of " & $iTotal & " Success: " & $sProcedure & $sProgress & @CRLF) Else ; Fail _ExtMsgBox(64, " ", " Fail!", $i & " of " & $iTotal & " -- " & $sProcedure & $sProgress, 2) ;~ ConsoleWrite("! " & $i & " of " & $iTotal & " Fail: " & $sProcedure & $sProgress & @CRLF) EndIf Next ; ----------------------------------------------- Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure 2_GR5 has completed! " ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) EndFunc ;==>BackupRestore ; ----------------------------------------------- Edited Sunday at 10:42 PM by donnyh13 LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
mr-es335 Posted Sunday at 10:48 PM Author Posted Sunday at 10:48 PM donnieh13, I did come up with the following: Spoiler expandcollapse popup#include <ExtMsgBox.au3> #include <FileConstants.au3> Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) BackupRestore(True) ;~ BackupRestore(False) Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sDrive, $sRelativePath, $iResult Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Test! " Local $sBaseBackupDir = "E:\Desktop\Working\BackupRestore\SourceData" ; --------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; --------------------- Local $aData[] = [ _ "E:\Desktop\Working\BackupRestore\MyAudio\1.wav", _ "E:\Desktop\Working\BackupRestore\MyAudio\2.wav"] ; ---------------------------------------------- Local $iTotal = UBound($aData) ; --------------------- For $i = 0 To UBound($aData) - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath ; --------------------- If $bIsBackup Then ; === Backup Logic (Src to Dst) === If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) ContinueLoop EndIf ; --------------------- If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) ; --------------------- Local $sMsgA = $sDst & " " _ExtMsgBox(64, " ", " Notice!", $sMsgA, 2) Else $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) ; --------------------- Local $sMsgA = $sDst & " " _ExtMsgBox(64, " ", " Notice!", $sMsgA, 2) EndIf ; --------------------- Else ; === Restore Logic (Swap Dest and Src) === ; --------------------- If StringInStr(FileGetAttrib($sDst), "D") Then $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) ; --------------------- Local $sMsgB = $sSrc & " " _ExtMsgBox(64, " ", " Notice!", $sMsgB, 2) Else $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) ; --------------------- Local $sMsgB = $sSrc & " " _ExtMsgBox(64, " ", " Notice!", $sMsgB, 2) EndIf EndIf Next ; --------------------- Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure Test has completed! " ; --------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) EndFunc ;==>BackupRestore donnyh13 1 mr-es335 Sentinel Music Studios
donnyh13 Posted Monday at 12:03 AM Posted Monday at 12:03 AM Looks pretty good. Is that what you're looking for? Or are you wanting a count too? You could add to the beginning of your messages, Quote $i & " of " & $iTotal & " " & mr-es335 1 LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
mr-es335 Posted Monday at 12:45 AM Author Posted Monday at 12:45 AM (edited) donnyh13, Though your initial "suggestion" was NOT what I was exactly looking for, your initial suggestion DID steer me in a direction that I simply had NOT thought about or even considered! And for this "direction steering", I am truly grateful!! PS: As a result, I have noted your initial offering as the solution!! By-the-way, ExtMsgBox has been a real blessing to me. At 72, my eye sight is NOT what it used to be! Thus having the ability to change not only the font size...but the font as well...has been a real God -send!! Thanks, Melba!! Edited Monday at 12:48 AM by mr-es335 donnyh13 1 mr-es335 Sentinel Music Studios
donnyh13 Posted Monday at 02:59 PM Posted Monday at 02:59 PM Glad to hear my tid-bit helped you mr-es335 and thanks for the solution mark. I'll have to check out the ExtMsgBox, it sounds helpful. Thanks for the review/suggestion! Best regards, Donny mr-es335 1 LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
mr-es335 Posted Tuesday at 01:46 PM Author Posted Tuesday at 01:46 PM (edited) Good day, So, I have managed "somewhat" to add a progress bar to ioa747's original script - which I just happen to love, but I do believe that there ARE issues that I simply cannot seem to resolve. In particular, the "; === Backup Logic (Src to Dst) ===" portion [Lines 34-47] tends to execute rather "quickly", whilst the "; === Restore Logic (Swap Dst and Src) ===" portion [Lines 50 to 63] tends to execute rather "slowly". Also, it appears that only one folder is being moved at a time - in this case the [Program Files] folder. However, if I execute the script again, then the next folder [ProgramData] is moved...and so on?!? What am I doing wrong here?!? Though, for the most part, ioa747's script has been working out extremely well for me, there ARE times when a progress indicator would come in very handy - in particular, at those times when I am manipulating large amounts of data. Any assistance here would be greatly appreciated! Here is the current script: Spoiler expandcollapse popup#include "ExtMsgBox.au3" #include <FileConstants.au3> Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) ;~ BackupRestore(True) BackupRestore(False) Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sDrive, $sRelativePath, $iResult Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Test_5! " Local $sBaseBackupDir = "E:\Desktop\Test_5\SourceData" ; --------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; --------------------- Local $aData[] = [ _ "E:\Desktop\Test_5\MyData\Program Files", _ "E:\Desktop\Test_5\MyData\ProgramData", _ "E:\Desktop\Test_5\MyData\RegKeys", _ "E:\Desktop\Test_5\MyData\Text", _ "E:\Desktop\Test_5\MyData\Users", _ "E:\Desktop\Test_5\MyData\Windows"] ; --------------------- For $i = 0 To UBound($aData) - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath ; --------------------- If $bIsBackup Then If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) ContinueLoop EndIf ; --------------------- ; === Backup Logic (Src to Dst) === ProgressOn("", "" & @CRLF & "...", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) ; --------------------- For $i = 10 To 100 Step 10 If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sSrc & " == >> " & $sDst & @CRLF) Else $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) ;~ ConsoleWrite($sSrc & " == >> " & $sDst & @CRLF) EndIf ; --------------------- ProgressSet($i, $i & "%") Next ; --------------------- Else ; === Restore Logic (Swap Dst and Src) === ProgressOn("", "" & @CRLF & "...", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) ; --------------------- For $i = 10 To 100 Step 10 If StringInStr(FileGetAttrib($sDst), "D") Then $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) Else $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) EndIf ; --------------------- ProgressSet($i, $i & "%") Next EndIf ; --------------------- ProgressSet(100, "Done", "Complete") Sleep(1000) ProgressOff() Next ; --------------------- Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Test_5 has completed! " ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) EndFunc ;==>BackupRestore Edited Tuesday at 02:04 PM by mr-es335 donnyh13 1 mr-es335 Sentinel Music Studios
donnyh13 Posted Tuesday at 04:17 PM Posted Tuesday at 04:17 PM (edited) Regarding the speed issue, the difference is between moving a file, and copying. Moving is quicker. (You can demonstrate this on your computer by manually copying and moving a large file, and see the difference). Regarding the random failure issue, I can't be sure. But one issue pops out at me, you have a For $i inside of a For $i loop. the inside For $i will increase the external $i count, so the top For $i will end with one loop. So change your progress bar loops from $i to maybe $j ? Or the top level loop. e.g. Spoiler expandcollapse popupFor $j = 0 To UBound($aData) - 1 $sSrc = $aData[$j] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath ; --------------------- If $bIsBackup Then If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) ContinueLoop EndIf ; --------------------- ; === Backup Logic (Src to Dst) === ProgressOn("", "" & @CRLF & "...", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) ; --------------------- For $i = 10 To 100 Step 10 If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sSrc & " == >> " & $sDst & @CRLF) Else $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) ;~ ConsoleWrite($sSrc & " == >> " & $sDst & @CRLF) EndIf ; --------------------- ProgressSet($i, $i & "%") Next ; --------------------- Else ; === Restore Logic (Swap Dst and Src) === ProgressOn("", "" & @CRLF & "...", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) ; --------------------- For $j = 10 To 100 Step 10 If StringInStr(FileGetAttrib($sDst), "D") Then $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) Else $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) EndIf ; --------------------- ProgressSet($j, $j & "%") Next EndIf ; --------------------- ProgressSet(100, "Done", "Complete") Sleep(1000) ProgressOff() Next or Spoiler expandcollapse popupFor $i = 0 To UBound($aData) - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath ; --------------------- If $bIsBackup Then If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) ContinueLoop EndIf ; --------------------- ; === Backup Logic (Src to Dst) === ProgressOn("", "" & @CRLF & "...", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) ; --------------------- For $j = 10 To 100 Step 10 If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sSrc & " == >> " & $sDst & @CRLF) Else $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) ;~ ConsoleWrite($sSrc & " == >> " & $sDst & @CRLF) EndIf ; --------------------- ProgressSet($j, $j & "%") Next ; --------------------- Else ; === Restore Logic (Swap Dst and Src) === ProgressOn("", "" & @CRLF & "...", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) ; --------------------- For $j = 10 To 100 Step 10 If StringInStr(FileGetAttrib($sDst), "D") Then $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) Else $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) ;~ ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) EndIf ; --------------------- ProgressSet($j, $j & "%") Next EndIf ; --------------------- ProgressSet(100, "Done", "Complete") Sleep(1000) ProgressOff() Next Edited Tuesday at 04:17 PM by donnyh13 ioa747 and mr-es335 1 1 LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
ioa747 Posted Tuesday at 04:27 PM Posted Tuesday at 04:27 PM Here is my attempt as well. expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include "ExtMsgBox.au3" #include <FileConstants.au3> #include <AutoItConstants.au3> Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) BackupRestore(True) ;~ BackupRestore(False) Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sDrive, $sRelativePath, $iTimeOut = 2 Local $sMsg = ($bIsBackup ? "Backup" : "Restore") & " Test_5! " Local $sBaseBackupDir = "E:\Desktop\Test_5\SourceData" ; --------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; --------------------- Local $aData[] = [ _ "E:\Desktop\Test_5\MyData1", _ "E:\Desktop\Test_5\MyData2", _ "E:\Desktop\Test_5\MyData3", _ "E:\Desktop\Test_5\MyData4", _ "E:\Desktop\Test_5\MyData5" _ ] Local $iTotal = UBound($aData) ProgressOn("Progress Meter", ($bIsBackup ? "Backup" : "Restore") & " in progress..." & @CRLF & "Please wait...", "0%", -1, -1) ;, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) For $i = 0 To $iTotal - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath Local $iPercent = Int((($i + 1) / $iTotal) * 100) If $bIsBackup Then ; === Backup Logic (Src to Dst) === If Not FileExists($sSrc) Then $sMsg &= "NOT FOUND " & $sSrc & @CRLF $iTimeOut = 5 ContinueLoop EndIf If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then ;~ $iResult = FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) Else ;~ $iResult = DirMove($sSrc, $sDst, $FC_OVERWRITE) ConsoleWrite($sSrc & " ==>> " & $sDst & @CRLF) EndIf Else ; === Restore Logic (Swap Dst and Src) === If Not FileExists($sDst) Then $sMsg &= "NOT FOUND " & $sDst & @CRLF $iTimeOut = 5 ContinueLoop EndIf If StringInStr(FileGetAttrib($sDst), "D") Then ;~ $iResult = DirCopy($sDst, $sSrc, $FC_OVERWRITE) ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) Else ;~ $iResult = FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) ConsoleWrite($sDst & " ==>> " & $sSrc & @CRLF) EndIf EndIf ProgressSet($iPercent, $iPercent & "%", "Processing: " & @CRLF & $sSrc & " ") Next ; Progress finale ProgressSet(100, "Done", "Complete") Sleep(1000) ProgressOff() ; --------------------- $sMsg &= " ... Test_5 has completed! " _ExtMsgBox(64, " ", " Notice!", $sMsg, $iTimeOut) EndFunc ;==>BackupRestore donnyh13 and mr-es335 1 1 I know that I know nothing
mr-es335 Posted Tuesday at 11:11 PM Author Posted Tuesday at 11:11 PM donnieh13, is there supposed to be difference between your last two examples? They both appear to be the same! Just curious! mr-es335 Sentinel Music Studios
donnyh13 Posted Tuesday at 11:47 PM Posted Tuesday at 11:47 PM (edited) @mr-es335, My last two examples alternate which "For $i" loop got renamed to "For $j". Either the main loop, or the two progress ones. Edited Tuesday at 11:52 PM by donnyh13 LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
mr-es335 Posted Wednesday at 12:23 AM Author Posted Wednesday at 12:23 AM (edited) donnyh13, Got it...thanks! Throwing this query "out to the void"...does ProgressOn ProgressOff and ProgressSet actually do anything "functional"? It would appear that these three functions produce something that is really unrelated to what is actually going on! For example. I can make the progress bar exit BEFORE all data has been copied|moved?!? Any insights here! For example, in my earlier offering, at least I can see progress as each folder|file is copied|moved. Spoiler expandcollapse popup#include <ExtMsgBox.au3> #include <FileConstants.au3> Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) BackupRestore(True) ;~ BackupRestore(False) Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sNewDst, $sDrive, $sRelativePath, $iResult Local $sMsg = "Backup | Restore [" & $bIsBackup & "] TestMe! " Local $sBaseBackupDir = "E:\Desktop\TestMe\SourceData" ; --------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; --------------------- Local $aData[] = [ _ "E:\Desktop\TestMe\MyData\Program Files", _ "E:\Desktop\TestMe\MyData\ProgramData", _ "E:\Desktop\TestMe\MyData\RegKeys", _ "E:\Desktop\TestMe\MyData\Text", _ "E:\Desktop\TestMe\MyData\Users", _ "E:\Desktop\TestMe\MyData\Windows", _ "E:\Desktop\TestMe\MyData\*.wav"] ; --------------------- For $i = 0 To UBound($aData) - 1 $sSrc = $aData[$i] $sDrive = StringLeft($sSrc, 1) $sRelativePath = StringTrimLeft($sSrc, 3) $sDst = $sBaseBackupDir & $sDrive & "\" & $sRelativePath ; --------------------- If $bIsBackup Then ; === Backup Logic (Src to Dst) === If Not FileExists($sSrc) Then Local $DataResult = FileExists($sSrc) ContinueLoop EndIf ; --------------------- If StringInStr(FileGetAttrib($sSrc), "D") = 0 Then FileMove($sSrc, $sDst, $FC_OVERWRITE + $FC_CREATEPATH) ; --------------------- $sNewDst = StringTrimLeft($sDst, 52) Local $sMsgA = "Backing-up to: " & $sNewDst & " " ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsgA, 1) Else DirMove($sSrc, $sDst, $FC_OVERWRITE) ; --------------------- $sNewDst = StringTrimLeft($sDst, 52) Local $sMsgA = "Backing-up to: " & $sNewDst & " " ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsgA, 1) EndIf ; --------------------- Else ; === Restore Logic (Swap Dest and Src) === ; --------------------- If StringInStr(FileGetAttrib($sDst), "D") Then DirCopy($sDst, $sSrc, $FC_OVERWRITE) ; --------------------- Local $sMsgB = "Restoring to: " & $sSrc & " " ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsgB, 1) Else FileCopy($sDst, $sSrc, $FC_OVERWRITE + $FC_CREATEPATH) ; --------------------- Local $sMsgB = "Restoring to: " & $sSrc & " " ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsgB, 1) EndIf EndIf Next ; --------------------- Local $sMsg = "Backup | Restore [" & $bIsBackup & "] TestMe has completed! " ; --------------------- _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) EndFunc ;==>BackupRestore Edited Wednesday at 12:24 AM by mr-es335 donnyh13 1 mr-es335 Sentinel Music Studios
donnyh13 Posted Wednesday at 03:23 PM Posted Wednesday at 03:23 PM Not sure I'm the one to answer this, but I will point out that @ioa747 offered a good example of a working Progress On, Set, etc. for your setup. The Progress bar, is really just a convenient pre-made GUI to make a quick visible "Progress". So yes, technically unrelated, but you make it related by inputting applicable percentages of completion . AutoIt's progress functions don't automatically monitor the script. They are completely 'blind' and only move or close when your code explicitly tells them to. Hopefully I understood your question. If not my apologies, and I'm hoping someone more competent comes along mr-es335 and ioa747 1 1 LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
water Posted Wednesday at 05:54 PM Posted Wednesday at 05:54 PM 17 hours ago, mr-es335 said: Throwing this query "out to the void"...does ProgressOn ProgressOff and ProgressSet actually do anything "functional"? Your join date and post count of 740 tell me that you are no newbie on this forum. So how about opening the help file and RTFM? Quote Give a man a fish and you feed him for a day teach a man to fish and you feed him for a lifetime. Just my 2 cents worth. donnyh13 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
mr-es335 Posted Wednesday at 10:50 PM Author Posted Wednesday at 10:50 PM (edited) water, You sated, "So how about opening the help file and RTFM? " What makes you "think" that I have NOT read the "FM? No offense, but due to my "cranial deprivation" at times, I do tend to find the HelpFile not very helpful! If the HelpFile IS helpful to others, I am very happy for them. But I dimply DO NOT find it very helpful at all in a number of situation..."progress" being one of them. Quote Critique of the Saying The phrase "teach a man to fish and you feed him for a lifetime" suggests that simply imparting skills will enable individuals to escape poverty. However, this perspective can be overly simplistic and fails to address deeper systemic issues. Limitations of the Saying Oversimplification: The adage assumes that acquiring skills alone is sufficient for self-sufficiency. It overlooks barriers such as: Market Access: Many individuals may know how to fish but lack access to markets where they can sell their catch. Capital: Without the necessary resources, such as fishing equipment or boats, the skills learned may not translate into economic independence. Context Matters: The effectiveness of teaching skills can vary greatly depending on local conditions. For instance, if a community lacks a viable fishing industry, teaching fishing skills may not lead to sustainable livelihoods. Edited Wednesday at 10:51 PM by mr-es335 donnyh13 1 mr-es335 Sentinel Music Studios
argumentum Posted Wednesday at 11:09 PM Posted Wednesday at 11:09 PM On 10/17/2026 at 5:20 PM, mr-es335 said: Func BackupRestore($bIsBackup) Local $sSrc, $sDst, $sDrive, $sRelativePath, $iResult Local $sMsg = "Backup | Restore [" & $bIsBackup & "] Procedure 2_GR5! " Local $sBaseBackupDir = "E:\Backups\App_Install\2_GR5\SourceData" ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sMsg, 2) ; ----------------------------------------------- Local $aData[] = [ _ "C:\Users\Public\Public Desktop\Guitar Rig 5.lnk", _ "C:\Windows\System32\msvcp120.dll", _ "C:\Windows\System32\msvcr120.dll", _ ...I don't participate in your posts because you said that if I didn't like it, stay away. So I did. @water may have spoken on my behalf because I would very well have posted the same words if not for you telling me to go away But, there is no forum rules against what you are doing, and there are those that do come to your aid so, good for you. There are things that you should know but may not. In the case of these msvc*.dll files, do install the VC++ ( 2013 in your case ) redistributable runtimes from MS as just adding stuff to System32 is a very bad idea. ...ok, carry on. I'll go back to my corner donnyh13 and mr-es335 1 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting
mr-es335 Posted Wednesday at 11:32 PM Author Posted Wednesday at 11:32 PM agumentum, My objective here is to create "portable apps"! So, I install the application as usual, I then document that installation and make a portable app from that information. • The original installer DID install VC++ 2013. I do hope that this makes sense? mr-es335 Sentinel Music Studios
argumentum Posted Wednesday at 11:38 PM Posted Wednesday at 11:38 PM (edited) 8 minutes ago, mr-es335 said: agumentum, My objective here is to create "portable apps"! So, I install the application as usual, I then document that installation and make a portable app from that information. • The original installer DID install VC++ 2013. I do hope that this makes sense? To install that, it registers itself and becomes part of the OS. Adding the 2 files you need may brake other stuff. If I were you, I'd check the version of the DLLs and if older than needed, or just plain missing, I'd install the current redistributable version, then continue with the portable installation/copy of the portable app. Some apps add those DLLs in it's own folder, and that is ok to do, but is not ok to just copy those files there in system32. Edited Wednesday at 11:41 PM by argumentum ioa747 and mr-es335 1 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now