Hi,
I'm attempting to write a script that has a couple of buttons (start, stop) and a couple of edit fields. When the user clicks the start button, I need it to run some sort of loop until they click the stop button. My problem is that once that loop is started with the user hitting the start button, the main GUI loop cannot regain control because its obviously stuck in an endless loop. Whats the best way to handle this? Here is an example of the code:
#include <GUIConstants.au3>
GUICreate("Test", 300, 300)
GUICtrlCreateLabel("Left Turn Time", 20, 10)
$left = GUICtrlCreateEdit("", 20, 30, 150, 40)
GUICtrlCreateLabel("Right Turn Time", 20, 90)
$right = GUICtrlCreateEdit("", 20, 110, 150, 40)
$startButton = GUICtrlCreateButton("Start", 20, 270, 60)
$stopButton = GUICtrlCreateButton("Stop", 90, 270, 60)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $startButton
MsgBox(0, "GUI Event", "You pressed start button!")
While 1
;... blah ...
Sleep(Random(120000,240000))
WEnd
Case $msg = $stopButton
MsgBox(0, "GUI Event", "You pressed stop button!")
Case $msg = $GUI_EVENT_CLOSE
MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
ExitLoop
EndSelect
WEnd