Hallo Zusammen
Ich bin eigentlich anfänger im Thema AutoIt, habe jedoch schon diverse Optionen versucht, die Progressbar einzubauen.
Das nachfolgende Script habe ich versucht in meines einzubauen, jedoch ohne erfolg
Code
Func CopyWithProgress($srcDir, $destDir)
If StringRight($srcDir, 1) = "\" Then $srcDir = StringLeft($srcDir, StringLen($srcDir) - 1)
If StringRight($destDir, 1) <> "\" Then $destDir = $destDir & "\"
If NotNot FileExists($destDir) Then DirCreate($destDir)
$srcSize = DirGetSize($srcDir, 1)
$1_percent = $srcSize[0] / 100
Run('XCOPY "'& $srcDir & '" "' & $destDir & '" /D /S /E /V /C /H /R /O /Y')
ProgressOn("Advanced status of file copying", $1_percent & "%", "")
Do
$destSize = DirGetSize($destDir, 1)
ProgressSet(Round($destSize[0] / $1_percent, 2), Round($destSize[0] / (1024 * 1024), 2) & " MB of " & Round($srcSize[0] / (1024 * 1024), 2)& " MB copied" & @CRLF _
& $destSize[1] & " of " & $srcSize[1] & " Files copied." & @CRLF _
& $destSize[2] & " of " & $srcSize[2] & " Folders copied.", Round($destSize[0] / $1_percent, 2) & "% - Done!")
Sleep(200)
Until $destSize[0] >= $srcSize[0]
ProgressOff()
EndFunc
Alles anzeigen
Mein Script ist eigentlich ganz simpel und vermutlich nicht Fehlerfrei, für ausführliche Kritik bin ich immer dankbar.
Mein Script:
Code
GUICreate("Betriebssystem wählen", 400, 120, 258, 217)
$WinXP = GUICtrlCreateButton("Windows XP", 0, 10, 100, 50)
$WinVista = GUICtrlCreateButton("Windows Vista", 100, 10, 100, 50)
$Win732 = GUICtrlCreateButton("Windows 7 32Bit", 200, 10, 100, 50)
$Win764 = GUICtrlCreateButton("Windows 7 64Bit", 300, 10, 100, 50)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Switch $msg
; Windows XP wird gestartet
Case $WinXP
MsgBox(64, "Windows XP", "Windows XP")
; Windows Vista wird gestartet
Case $WinVista
MsgBox(64, "Windows Vista", "Windows Vista")
; Windows 7 -32Bit wird gestartet
Case $Win732
MsgBox(64, "Windows 7", "Windows 7 32Bit - Dateien werden kopiert (c.a 1min)", 5)
Sleep(2500)
DriveMapAdd ("b:", "\\Imageserver\Installation\Win7\32")
Sleep(1000)
DirCreate("C:\Installation")
DirCopy("b:\", "C:\", 1)
Sleep(200)
DriveMapDel ("b:")
Sleep(300)
ShellExecute("C:\Installation\go.bat")
Sleep(300)
ProcessClose("start.exe")
; Windows 7 - 64Bit wird gestartet
Case $Win764
MsgBox(64, "Windows 7", "Windows 7 64 Bit", 2)
Sleep(2500)
DriveMapAdd ("b:", "\\Imageserver\Installation\Win7\64")
Sleep(1000)
DirCreate("C:\Installation")
DirCopy("b:\", "C:\", 1)
Sleep(200)
DriveMapDel ("b:")
ShellExecute("C:\Installation\go.bat")
ProcessClose("start.exe")
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Alles anzeigen
Wie man sieht, geht es mir nur umd die Windows 7 Versionen, XP und Vista wird im gleichen Style vervollständigt.
Das Verzeichnis das kopiert wird ist etwa 80MB Gross, und dauert etwa 1Minute, je nach Computer
Danke für Eure Hilfe