BlueScreen Posted February 1, 2004 Posted February 1, 2004 Beware! This is going to be a stupid one. For $Iteration=1 to 5 proc1 () proc2 () proc3 () proc4 () Next exit func proc1 () msgbox (0,"","1") endfunc func proc2 () ;some code here ;WHAT TO PUT HERE IN ORDER TO CONTINUE TO THE NEXT 'FOR' ITERATION FROM THIS FUNCTION?? endfunc func proc3 () msgbox (0,"","3") endfunc func proc4 () msgbox (0,"","4") endfunc
Developers Jos Posted February 1, 2004 Developers Posted February 1, 2004 For $Iteration=1 to 5 proc1 () if proc2 () = 1 then proc3 () proc4 () endif Next exit func proc1 () msgbox (0,"","1") endfunc func proc2 () ;some code here ;WHAT TO PUT HERE IN ORDER TO CONTINUE TO THE NEXT 'FOR' ITERATION FROM THIS FUNCTION?? if "...this is true then loop..." then return(0) else return(1) endif endfunc func proc3 () msgbox (0,"","3") endfunc func proc4 () msgbox (0,"","4") endfunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
BlueScreen Posted February 1, 2004 Author Posted February 1, 2004 OK. 10x JdeB. I thought about that but this means that if I want to check every function, I'll have to put lots of "IF". If I understand correctly, there is not an other way to do it, right from the function, right?
Developers Jos Posted February 1, 2004 Developers Posted February 1, 2004 (edited) is this what you would like to do ?? For $Iteration=1 to 5 $t = 0 proc1 () if $t = 0 then proc2 () if $t = 0 then proc3 () if $t = 0 then proc4 () Next exit func proc1 () if "...this is true then loop..." then $t=1 msgbox (0,"","1") endfunc func proc2 () ;some code here ;WHAT TO PUT HERE IN ORDER TO CONTINUE TO THE NEXT 'FOR' ITERATION FROM THIS FUNCTION?? if "...this is true then loop..." then $t=1 endfunc func proc3 () if "...this is true then loop..." then $t=1 msgbox (0,"","3") endfunc func proc4 () msgbox (0,"","4") endfunc Edited February 1, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
BlueScreen Posted February 1, 2004 Author Posted February 1, 2004 Yep. This is it. The issue is that in AutoIt 91 (and greather), it is no more (but justified) possible to use NEXT from a function in order to continue a for Loop, so I thought there is a new command that can do it (in order to avoid all the "IF". 10x JdeB. I'll use your suggestion.
Developers Jos Posted February 1, 2004 Developers Posted February 1, 2004 jon added more syntax checking in 3.0.88 .. one of them was:- Changed: All block structures (IF/WHILE/FOR, etc.) are now checked before execution. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
CyberSlug Posted February 1, 2004 Posted February 1, 2004 (edited) JdeB, in your second example, does $t need to be declared as a Global variable? Here's another (but related) idea that depends on the return values of each proc:For $Iteration=1 to 5 proc1 () If proc2 () then ContinueLoop If proc3 () then ContinueLoop If proc4 () then ContinueLoop Next Edit: fixed code /code tags Edited February 1, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Developers Jos Posted February 1, 2004 Developers Posted February 1, 2004 (edited) CyberClug, When a Variable is used before calling the Function it is know at the function level so guess can be considered Global. try the below script... Forgot about the ContinueLoop ... agree that its better to use it as you show and use the Return(1) in stead of $t=1 in the function. For $Iteration=1 to 4 $t = 0 proc1 () if $t = 0 then proc2 () if $t = 0 then proc3 () if $t = 0 then proc4 () Next exit func proc1 () if $Iteration = 1 then $t=1 msgbox (0,"","1") endfunc func proc2 () if $Iteration = 2 then $t=1 msgbox (0,"","2") endfunc func proc3 () if $Iteration = 3 then $t=1 msgbox (0,"","3") endfunc func proc4 () msgbox (0,"","4") endfunc Edited February 1, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Valik Posted February 2, 2004 Posted February 2, 2004 Doesn't ContinueLoop restart the loop from the top, thus none of the code below will be executed? I can't remember, I haven't used it in awhile, but I thought it was the same as C's contine keyword which restarts the loop again.
CyberSlug Posted February 2, 2004 Posted February 2, 2004 (edited) Doesn't ContinueLoop restart the loop from the top, thus none of the code below will be executed? I can't remember, I haven't used it in awhile, but I thought it was the same as C's contine keyword which restarts the loop again.From the help file:;Print all numbers from 1 to 10 except number 7 For $i = 1 to 10 If $i = 7 Then ContinueLoop MsgBox(0, "The value of $i is:", $i) Next I think that is what BlueScreen wants.... Try it out after you get your computer working! Edited February 2, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Valik Posted February 2, 2004 Posted February 2, 2004 Thanks CyberSlug, I see that I was correct on what ContinueLoop did (Yay for my memory working for once), but was incorrect on what was trying to be achieved. I just went back and re-read some of the posts and see that I interpreted the goal wrong. Now that I've taken a second look, I also think that is what he wanted to do. It threw me off slightly seeing so many "If function Then ContinueLoop" statements in a row.
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