Gotemp Posted December 7, 2012 Share Posted December 7, 2012 Is it possible to jump back into a case where you left off? I'll post some demo code with what i mean and i keep having ideas on how to do it but so far they have failed, even re-wrote the damn thing which took me a good 30mins and then... it failed! Anyway here is an example i just wrote because i dont know if im doing it right or if there is a better way, plus its getting late. Sorry its not indented or anything, the autoit code button always fails to work properly. -.- expandcollapse popupGlobal $action = 1 Global $action1 = 3 Global $action2 = 2 Func Test() Do Select Case $action = 1 Select Case $action1 = 1 Check() ;code for action1 Case $action1 = 2 Check() ;code for action2 Case $action1 = 3 Check() ;code for action3 EndSelect Case $action = 2 Select Case $action2 = 1 Check() ;code for action1 Case $action2 = 2 Check() ;code for action2 Case $action2 = 3 Check() ;code for action3 EndSelect EndSelect Until $action > 4 Exit EndFunc Func Check() ;imageseach code here if $image = 1 then ;image exsists it shouldnt so re-run code Check() ElseIf $image = 0 Then ;image does not exsist this is good continue ;where $action1,$action2 or $action3 left off EndIf EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2012 Share Posted December 7, 2012 (edited) ContinueCase Perhaps. Edited December 7, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 7, 2012 Moderators Share Posted December 7, 2012 Gotemp,Your Check() function is not well written - you are making it infinitely recursive. Read the Recursion tutorial in the Wiki to see why this is not a good idea. I would rewrite it something like this: Func Check() Local $image = 1 While $image = 1 ;imageseach code here Wend ; We get here if Image = 0 ;image does not exsist this is good continue ;where $action1,$action2 or $action3 left off ; And so we now return EndFunc ;==>CheckNow what exactly do you want to do when you return from this function? If all you want to do is run the next case you should look at ContinueCase. Or do you want to rerun the whole Select structure again? 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...
Gotemp Posted December 8, 2012 Author Share Posted December 8, 2012 (edited) Thanks Melba will read up on recursion, i normally use a loop and sleep command but i wrote this code right before bed when i was very tired and im still tired now i got up! But here is what i mean The code is a loop of 5 Paretns, within them 5 Parents are the children which is the code that the user picks for example if the user picks child3 > Check runs = 0 Continue with child3 code once thats complete goto the next parent and child action so in the code below we need to do all the code in Parent1 > Child3 before we move onto Parent2 > Child1 So its Parent > Child3 > Check > Child3 > Parent2 > Child1 > Check > Chld1 > Parent3 if that makes sense guess not because im confused o.O lol expandcollapse popup$parent = 1 $child1 = 3 $child2 = 1 Func Test() Do Select Case $parent = 1 Select Case $child1 = 1 Check() ;code for action1 $parent = $parent + 1 Case $child1 = 2 Check() ;code for action2 $parent = $parent + 1 Case $child1 = 3 Check() ;code for action3 $parent = $parent + 1 EndSelect Case $parent = 2 Select Case $child2 = 1 Check() ;code for action1 $parent = $parent + 1 Case $child2 = 2 Check() ;code for action2 $parent = $parent + 1 Case $child2 = 3 Check() ;code for action3 $parent = $parent + 1 EndSelect EndSelect Until $parent > 4 Exit EndFunc Also which browser is beter for the autoit code? Im using chrome and its always indented to the left like above makes it hard to read imo :/ anyawy better get ready off out for the day. Edited December 8, 2012 by Gotemp Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 8, 2012 Moderators Share Posted December 8, 2012 Gotemp,if that makes sense guess not because im confusedAnd so am I. If you want some help, please explain clearly what it is you are trying to do. At the moment I cannot really work out the logic behind your request and I am not prepared to code several possible solutions on the off-chance that one meet your requirements. 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...
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