clearguy Posted June 13, 2006 Author Posted June 13, 2006 I looked at it,but I don't really know if it would help me. My script is based too on OneEventMode with a loop. When the button start is pressed,a very long function with calculate and do so stuff is started,and the button 'start' becomes "stop". What I want is to stop this many minutes long function when the button 'stop' is pressed. it look like this GUICreate($Title, 550, 300) $start = GUICtrlCreateButton("START",250,200,45,20) GUICtrlSetOnEvent($start,"startB") While 1 sleep(1000) ; Idle around WEnd Func startB() $TimerAll = TimerInit() $status = GUICtrlRead($start) If $status = "START" Then GUICtrlSetData($start,"STOP") $status = GUICtrlRead($start) MsgBox(0,"System","Démarrer...") $GlobalStop = "no" wait() EndIf If $status = "STOP" Then ;this is if the press on stop would work GUICtrlSetData($start,"Stopped") MsgBox(0,"System","Arrêter...") $GlobalStop = "yes" EndIf EndFunc Func wait() ;very long function EndFunc the problem is just that when we are in wait() the press on stop don't call startB() to set a stop variable which would abort the long wait()function...any solution? I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français
JSThePatriot Posted June 13, 2006 Posted June 13, 2006 I looked at it,but I don't really know if it would help me. My script is based too on OneEventMode with a loop. When the button start is pressed,a very long function with calculate and do so stuff is started,and the button 'start' becomes "stop". What I want is to stop this many minutes long function when the button 'stop' is pressed. it look like this GUICreate($Title, 550, 300) $start = GUICtrlCreateButton("START",250,200,45,20) GUICtrlSetOnEvent($start,"startB") While 1 sleep(1000); Idle around WEnd Func startB() $TimerAll = TimerInit() $status = GUICtrlRead($start) If $status = "START" Then GUICtrlSetData($start,"STOP") $status = GUICtrlRead($start) MsgBox(0,"System","Démarrer...") $GlobalStop = "no" wait() EndIf If $status = "STOP" Then;this is if the press on stop would work GUICtrlSetData($start,"Stopped") MsgBox(0,"System","Arrêter...") $GlobalStop = "yes" EndIf EndFunc Func wait() ;very long function EndFunc the problem is just that when we are in wait() the press on stop don't call startB() to set a stop variable which would abort the long wait()function...any solution? What is happening is your fucntion is stuck at wait() until it finishes the function cannot be run again nor are you out of that function yet. I have responded to similar needs in the past. I will find the thread. He got his issues straightened out. You may have to create a second .exe to run once the start has occurred that way you can still have control of stopping the function using ProcessKill() I hope this helps further, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
clearguy Posted June 13, 2006 Author Posted June 13, 2006 hum,and when I would include all wait() direct in startB(),would it work?? Because I've already thought about creating a second.exe,but I use the GUIWindow in which wait() modifys things like statistics and so... I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français
JSThePatriot Posted June 14, 2006 Posted June 14, 2006 hum,and when I would include all wait() direct in startB(),would it work??Because I've already thought about creating a second.exe,but I use the GUIWindow in which wait() modifys things like statistics and so...Because AutoIt uses Windows Controls then you can use the Control*() commands to modify your current GUI. You dont "include" your second EXE. You would probably FileInstall() it. Then Run("WaitFunction.exe") or something similar.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
clearguy Posted June 16, 2006 Author Posted June 16, 2006 Ok so I will try with a second exe...Try puttingCODE: AutoItIf $StopNow = 0 Then...;your functionEndIfaround each of your functions, then use Adlib to set the previously-defined Global variable $StopNow to 1 when the button is pressed...not much better, but at least you're only 'polling' the GUI events in one place.For this,where must I put the AdlibEnable("myadlib")?And in the Func myadlib() have I to put the GUIGetMsg() ?Thanx for helping,gonna have the solution maybe in some days I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français
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