cascius Posted March 7, 2013 Share Posted March 7, 2013 Hi everyone, I have a question regarding restarting my main loop from within a function. I won't share my script as it's very long and could use some serious clean up. Rather I'll give you a simple example: While 1 _MyFunction_1() _MyFunction_2() _MyFunction_3() _MyFunction_4() WEnd Func _MyFunction_3() If $x = 1 Then ;RESTART THE MAIN While Else ... EndIf EndFunc So in this example, I want to restart the WHILE when $x = 1, but I'm not sure how this can be done. I hope somebody can help. Thanks in advance, - Olivier Link to comment Share on other sites More sharing options...
jdelaney Posted March 7, 2013 Share Posted March 7, 2013 (edited) look into conditionally using continueloop, or only proceeding to the next _myfunction if the return of the current is as expected While 1 _MyFunction_1() _MyFunction_2() If Not _MyFunction_3() Then ContinueLoop _MyFunction_4() WEnd --OR-- While 1 _MyFunction_1() _MyFunction_2() $bContinue = _MyFunction_3() If $bContinue Then _MyFunction_4() WEnd --OR-- While 1 _MyFunction_1() _MyFunction_2() If _MyFunction_3() Then _MyFunction_4() WEnd Func _MyFunction_3() If $x = 1 Then ;RESTART THE MAIN While Return False Else ... EndIf Return True EndFunc ;==>_MyFunction_3 lots of ways to skin the cat Edited March 7, 2013 by jdelaney cascius 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
cascius Posted March 7, 2013 Author Share Posted March 7, 2013 Pretty cool. I'm surprised I didn't think of that. Thanks a lot for the quick help, this gave me a bunch of ideas. This can be marked as solved. - Olivier 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