phatzilla Posted September 14, 2011 Share Posted September 14, 2011 So heres the story, i have a gui button "start", when i press it will start a rather long winded function that runs on a loop (If i were to wait for it to finish, would take ~5 minutes or so). However, i want a "stop" button wherein if i push it, it will stop the function at any time. Here's the relevant code While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ;############################################## Clicked on Play Increase Button ##################################################################### Case $msg = $Go guisetfont(9,4000,0) GUICtrlCreateLabel(guictrlread($increase), 260, 130, 300, 50) GUICtrlCreateLabel("# increased : ", 157, 170, 300, 15) $increaser = guictrlcreatelabel("0",260,170,100,15) increaser() ; run our increaser function ;############################################## Clicked on Stop Play increaser ##################################################################### case $msg = $stop Dont iknow what to put here! EndSelect WEnd So after i click start, the "increaser()" function begins, however i want to be able to stop that function even if its half way through, but it seems as if it only waits for the function to finish before any buttons become "active" on the gui... any help Link to comment Share on other sites More sharing options...
flet Posted September 14, 2011 Share Posted September 14, 2011 http://www.autoitscript.com/wiki/Interrupting_a_running_function Link to comment Share on other sites More sharing options...
ravaged1 Posted September 14, 2011 Share Posted September 14, 2011 I'm a newbie to this stuff still but I think you just loop the function until it's done or you hit the button and end function. Link to comment Share on other sites More sharing options...
wakillon Posted September 16, 2011 Share Posted September 16, 2011 Replace "Dont iknow what to put here!" by ExitLoop AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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