Sign in to follow this  
Followers 0
JayHawkfl

Functions ssigned to buttons run infinitely

3 posts in this topic

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. :thumbsdown:

Thanks in advance for your time folks

#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

 

Share this post


Link to post
Share on other sites



; 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

Share this post


Link to post
Share on other sites

Sure enough, that was the problem. Thank you Dany


Thanks for your time

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0