JayHawkfl Posted September 24, 2012 Share Posted September 24, 2012 I'm running dos commands in my GUI, the problem I'm seeing is that the dos commands are looping. Which makes sence since my buttons are inside of a while loop, but I've been looking and it seems like I'm doing it the same way I'm seeing in the examples so I'm looking for my error. Since I'm here, we can assume I haven't found it yet. Thanks in advance for your time folks expandcollapse popup#include #include #include #include #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 305, 205, 192, 114) $TreeView1 = GUICtrlCreateTreeView(16, 16, 169, 169) $Button1 = GUICtrlCreateButton("DB OFF", 208, 16, 75, 25) $Button2 = GUICtrlCreateButton("DB ON", 208, 64, 75, 25) $Button3 = GUICtrlCreateButton("RELOAD DB", 208, 112, 75, 25) $Button4 = GUICtrlCreateButton("RELOAD CC", 208, 160, 75, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 = Run(@ComSpec & " /c " & 'dbsetup /stopall', "", @SW_HIDE) Case $Button2 = Run(@ComSpec & " /c " & 'dbsetup /startall', "", @SW_HIDE) Case $Button3 = Run(@ComSpec & " /c " & 'dbsetup /stopall', "", @SW_HIDE) Run(@ComSpec & " /c " & 'dbsetup /startall', "", @SW_HIDE) Case $Button4 = Run(@ComSpec & " /c " & 'net stop fposcreditcard5', "", @SW_SHOW) Run(@ComSpec & " /c " & 'net start fposcreditcard5', "", @SW_SHOW) EndSwitch WEnd Local $ws[25] Local $wsPing[25] Local $i = 0 Local $WSName = 0 Local $WSIP = 0 Local $WSIPTest = 0 While $i < 20 $i = $i + 1 $Tmp = "WS" & $i $ws[$i] = IniRead("C:\FPOS5\FPOS5 extras\workstationlist.ini", "WORKSTATIONLIST", $Tmp, "xxx") If ($ws[$i] <> "") And ($ws[$i] <> "xxx") Then $TotalWS = $i $wsPing[$i] = Ping($ws[$i]) EndIf WEnd ;MsgBox(0, "workstations on the network", $TotalWS) ;tests the while loop at line22 Thanks for your time Link to comment Share on other sites More sharing options...
dany Posted September 24, 2012 Share Posted September 24, 2012 ; Here $Button1 is compared to the PID returned by Run() which will fail... Case $Button1 = Run(@ComSpec & " /c " & 'dbsetup /stopall', "", @SW_HIDE) So no, you're not doing it the same way as in the examples: Case $Button1 ; Check if this button is clicked... Run(@ComSpec & " /c " & 'dbsetup /stopall', "", @SW_HIDE) ; Run the command if it is. Case $Button2 ; ... etc. [center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF Link to comment Share on other sites More sharing options...
JayHawkfl Posted September 24, 2012 Author Share Posted September 24, 2012 Sure enough, that was the problem. Thank you Dany Thanks for your time Link to comment Share on other sites More sharing options...
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