MeisterMan Posted November 7, 2013 Share Posted November 7, 2013 (edited) i searched and googled for 2nd day today got sick of doing it cant find the answer. but my problem is ... when i click stop the loop stops... but adlib doesnt work anymore... i have to click X for it start running again afterwards ... but if ill stop again then it will exit the whole thing. expandcollapse popupguicreate("") $runbutton = guictrlcreatebutton("") guictrlsetoevent($runbutton, "_run") $stopbutton = guictrlcreatebutton("") guictrlsetonevent($stopbutton, "_stop") guisetstate() adlibregister("_something", 2000) ; this isnt working after you click a button to exit the _something() loop ... while 1 ;do anything here $return_point wend func _run() $switch = 1 $go = 1 ;then adlib will call the func and because $switch is 1.. the loop will run... endfunc func _stop() $go = 0 ;set this to 0 on button click to end the looping... $switch = 0 endfunc func _something() while $switch = 1 $switch = 0 ; this will set $switch off so this While loop isnt in constant looping mode. ;do other things here when this func is called ;somewhere in the middle of the code we put this if $go = 0 then exitloop ; and this is where i want to return to $return_point variable... return $return_variable didnt seem to work for me.. ? ;and also only enter this loop if $switch is set to 1 by pressing a button on main gui... wend if $go = 0 then $switch = 0 endfunc Edited November 7, 2013 by MeisterMan Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 7, 2013 Moderators Share Posted November 7, 2013 MeisterMan,Sorry, that collection of apparently random lines makes no sense to me at all. Why not explain what it is that you want to happen in your script and then we can try to develop something coherent that works. 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 Link to comment Share on other sites More sharing options...
MeisterMan Posted November 7, 2013 Author Share Posted November 7, 2013 *updated better.... sorry Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 7, 2013 Moderators Share Posted November 7, 2013 MeisterMan,Firstly, if you spend more than 2 secs in your _something function than you are in big trouble. You will still be in the function when it is called again - and queuing Adlib functions is a recipe for disaster. If you think you might be doing this, you need to UnRegister the Adlib function as you enter it and then re-Register it as you leave. Secondly, breaking into a running function is not easy in AutoIt - see the Interrupting a running function tutorial in the Wiki to see how you might go about it. But I return to my earlier point - please explain exactly what it is you want to do so that we can come up with the most sensible way of coding it for you. Just trying to get your current minimalist script to work will almost certainly not provide you with the correct method for what you actually want to do. 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 Link to comment Share on other sites More sharing options...
MeisterMan Posted November 7, 2013 Author Share Posted November 7, 2013 ok so i should unRegister adlib inside the _something() function ? yeah i read the "interupting a running function" its about guionevent which is why i put the 2 buttons with guictrlsetonevent() with returning thing though ... what i want to do is like .. say we have 2 loops... while 1 ;do some main and most importants things .... or w.e. $return wend ;now we have a function with a while loop inside it ;like i posted above in the fiirst post func _something() while 1 return $return ; but i know that "Return" does not go to the specific point like in this case go to $return and ;continue looping inside the first while loop... wend endfunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 7, 2013 Moderators Share Posted November 7, 2013 MeisterMan, i read the "interupting a running function" its about guioneventNo it is not. It shows that both GUI modes suffer from the same problem and require the same solutions, although there is a possible shortcut if you use OnEvent in a specific way - which you are not doing here. So for the last time, please explain what it is that you want to do in this script rather than continue to post useless snippets of pseudo-code which mean absolutely nothing. If you want help then tell us the purpose of this script - otherwise there is no point in continuing. Your choice. 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 Link to comment Share on other sites More sharing options...
MeisterMan Posted November 7, 2013 Author Share Posted November 7, 2013 grrr i dont know how to explain better.... i want to return from second while loop to first while loop so basicly stop second loop and go back into first loop. make sense? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 7, 2013 Moderators Share Posted November 7, 2013 MeisterMan,OK, I am out of this thread. With no idea of what these loops do, what kind of code is in them, or any idea of the overall aim of the script I am not wasting my time writing code which may or may not fit the bill. 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 Link to comment Share on other sites More sharing options...
MeisterMan Posted November 7, 2013 Author Share Posted November 7, 2013 the loops dont do anything... they do whatever .. they are just loops but i just dont know how to go back to first loop and continue looping in the first while loop Link to comment Share on other sites More sharing options...
MeisterMan Posted November 10, 2013 Author Share Posted November 10, 2013 (edited) i kept looking at forums and found simple solution. not 100% effective but works 90% ild say and the answer is .. for anyone else that will need in future ... while 1 ;main gui while loop.... if $on = 1 then ;you change the variable value with a button or whatever..... while $on = 1 ;your whatever thing loop here... ;do things here... ;if you would want to exit loop while processing it through with loads of things just put this.. exitloop ;if you have more than one or two loops then for example... while $set = 1 ;do something here then ... while $go = 1 ;do something here and exit if $on = 0 then exitloop 3 ;this will exit all loops and go into the first gui loop to continue showing main gui.... wend wend wend endif ;exitloop [3] will go here automatically... :P wend those who will really need such thing will understand... Edited November 10, 2013 by MeisterMan SorryButImaNewbie and zenesin 1 1 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