Velnes Posted March 9, 2011 Posted March 9, 2011 hi autoit team i have 2 buttons start and stop [examples] and if u press start it runs functiosn as follows func _run() ;==some loop here func2() endfunc func func2() ;looop here is well _run() ;returns back and does the same things again.... endfunc and now bcz of this stop button wont work... how to make the button work .. to just stop all progress not pause or exit the program(gui)
JohnOne Posted March 9, 2011 Posted March 9, 2011 hi autoit team i have 2 buttons start and stop [examples] and if u press start it runs functiosn as follows func _run() ;==some loop here func2() endfunc func func2() ;looop here is well _run() ;returns back and does the same things again.... endfunc and now bcz of this stop button wont work... how to make the button work .. to just stop all progress not pause or exit the program(gui) I cant see a button in your code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Velnes Posted March 9, 2011 Author Posted March 9, 2011 well i just gave an example... lets say button is $btn = guictrlcreatebutton("stop/start", 0, 0, 100, 20) ;supposed to be 2 buttons but lets do with one...
Moderators Melba23 Posted March 9, 2011 Moderators Posted March 9, 2011 Velnes,That snippet you posted will lead you into big trouble. It is infinitely recursive - that is to say that you call a function again from within itself - like this:Start _run() - instance 1 Start func2() - instance 1 Start _run() - instance 2 Start func2() - instance 2 Start _run() - instance 3 and so on ad infinitum......you never return from any of the functions. :blink:First I suggest that you read the Recursion tutorial in the Wiki - it will explain why recursion can be so dangerous.Next, I suggest you rewrite your script so that you do not use infinitely recursive loops like that.Finally, I suggest you read the Interrupting a running function tutorial in the Wiki - which should help you see how to keep your "Stop" button active even when you are running your functions.Have fun! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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