Jump to content

Restarting a While statement on event


Recommended Posts

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

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 by jdelaney
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...