Hey
Hab mal ein Problem. Ich arbeite an ein Backup Programm und die For Schleiche will nicht richtig :wacko:
Hier der Code
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Debug.au3>
_DebugSetup("CMD Return ***ESC to close***")
HotKeySet("{ESC}", "end")
$pid = Run("cmd.exe", "C:\", @SW_HIDE, 0x9)
#Region ### START Koda GUI section ### Form=D:\Administrator\Documents\StevenX Media\User Backup Starter\Gui.kxf
$GUI1 = GUICreate("User Backup Start ©LimeSoft Solutions", 716, 396, 186, 122)
$MenuItem1 = GUICtrlCreateMenu("File")
$Save_sett_sl = GUICtrlCreateMenuItem("Save Settings", $MenuItem1)
$Load_sett_sl = GUICtrlCreateMenuItem("Load Settings", $MenuItem1)
$About_sl = GUICtrlCreateMenuItem("About", $MenuItem1)
$Label1 = GUICtrlCreateLabel("User Backup Starter", 192, 24, 360, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
$User_Folders_sl = GUICtrlCreateButton("Select", 208, 120, 291, 33)
$Label2 = GUICtrlCreateLabel("1. Select User Folders", 32, 128, 108, 17)
$Label3 = GUICtrlCreateLabel("2. Select Media Types to backup", 32, 187, 161, 17)
$Types_sl = GUICtrlCreateCombo("Select", 208, 184, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"AppData|Music|Downloads|Videos", "Select")
$Add_types_sl = GUICtrlCreateButton("Add", 368, 184, 131, 25)
$ListView2 = GUICtrlCreateListView("User", 512, 120, 186, 110)
$ListView = GUICtrlCreateListView("Type|Backup", 511, 243, 186, 110)
$Label4 = GUICtrlCreateLabel("3. Select the backup path", 32, 256, 127, 17)
$Path_sl = GUICtrlCreateButton("Select", 209, 251, 291, 33)
$Start_backup_sl = GUICtrlCreateButton("Start Backup ", 32, 312, 467, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $Types[5], $Folders[4]
$Types[1] = 0
$Folders[1] = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Add_types_sl
$Types[1]=$Types[1] + 1
$Types[$Types[1]] = GUICtrlRead($Types_sl)
GUICtrlCreateListViewItem (GUICtrlRead($Types_sl)&"|Yes", $ListView)
Case $User_Folders_sl
$Folders_sl = FileSelectFolder( "Select Folders", @HomeDrive & '\Users', 1+2+4)
$Folders[1]=$Folders[1] + 1
$Folders[$Folders[1]] = $Folders_sl
GUICtrlCreateListViewItem ($Folders_sl, $ListView2)
Case $Path_sl
$Path = FileSelectFolder( "Select Path", "")
Case $Start_backup_sl
For $i = 2 to $Folders[1] Step 1
_engine( "robocopy " & $Folders[$i] & '\' & 'Music\ ' & $Path & '\UBS\' &$Folders[$i] & '\Music \MIR')
_engine( "robocopy " & $Folders[$i] & '\' & 'Videos\ ' & $Path & '\UBS\' &$Folders[$i] & '\Videos \MIR')
_engine( "robocopy " & $Folders[$i] & '\' & 'Downloads\ ' & $Path & '\UBS\' &$Folders[$i] & '\Downloads \MIR')
_engine( "robocopy " & $Folders[$i] & '\' & 'Documents\ ' & $Path & '\UBS\' &$Folders[$i] & '\Documents \MIR')
Next
EndSwitch
WEnd
Func _engine($Command)
StdinWrite($pid, $Command & @CRLF)
$msg = StdoutRead($pid)
$msg = StringStripWS($msg,3)
$msg = StdoutRead($pid)
$msg = StringStripWS($msg,3)
If $msg <> "" Then
_DebugOut($msg)
EndIf
Sleep(100)
EndFunc
Func end()
ProcessClose($pid)
Exit
EndFunc
Hab drüber geschaut und warscheinlich entgeht mir ein peinlicher Fehler .
Thx,
StevenX