v3rt1g0 Posted February 18, 2008 Posted February 18, 2008 What I'm trying to do is grab some machine names from a list box, and then copy an .exe to the same share on each machine. The problem is that the first and last loop always return zero for $currmach. Am I not using _GUICtrlListBox_GetText correctly? I've also tried using an array to hold the machine names, but with the same result. What am I doing wrong? $machines = GUICtrlCreateList("", 17, 384, 130, 160) $machinename = GUICtrlCreateInput("Sysname", 161, 425, 79, 23) $datapath = GUICtrlCreateInput("c:\etc", 272, 377, 120) Func Launch() $app = "clientinstall.exe" ;placeholder $totalmach = _GUICtrlListBox_GetCount($machines) While $machcount <= $totalmach $currmach = _GUICtrlListBox_GetText($machines, $machcount) TrayTip("Copying Setup Data to " & $currmach & ".","xWeb Launcher",10) FileCopy("\\server\share\setup\auto\bin\" & $app & "", "\\" & $currmach & "\auto", 1) FileCopy("" & GUICtrlRead($datapath) & "\setupdata.kh","\\" & $currmach & "\auto", 1) Sleep(2000) If Not FileExists("\\" & $currmach & "\auto\" & $app & "") Then FileCopy("\\server\share\setup\auto\bin\" & $app & "", "\\" & $currmach & "\auto", 1) FileCopy("" & GUICtrlRead($datapath) & "\setupdata.kh","\\" & $currmach & "\auto", 1) Sleep(2000) If Not FileExists("\\" & $currmach & "\auto\" & $app & "") Then MsgBox(0,"Error","Copy of " & $app & " to " & $currmach & " failed.",5) EndIf $machcount = $machcount + 1 WEnd EndFunc While 1 $msg = GUIGetMsg() Select Case $msg = $machinename _GUICtrlListBox_AddString($machines,GUICtrlRead($machinename)) Case $msg = $launch Launch() EndSelect WEnd
v3rt1g0 Posted February 19, 2008 Author Posted February 19, 2008 Stupid simple mistake as usual. Helps if I declare $machcount = 0
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