← Back to team overview

sikuli-driver team mailing list archive

[Question #239537]: How to simulate "GoTo" - end subroutine if condition met?

 

New question #239537 on Sikuli:
https://answers.launchpad.net/sikuli/+question/239537

How would you make a script go to the end of the sequence, if a certain condition is met?

Here's what I have now:

def SubRoutine1(n):
    {some code}
...
def SubRoutine20(n):
   {some more code}
...
def CheckIfConditionIsMet(n):
    {checks condition}

for a in range(1):
    SubRoutine1(a)
    CheckIfConditionIsMet(a)
    SubRoutine2(a)
    CheckIfConditionIsMet(a)
    SubRoutine3(a)
    CheckIfConditionIsMet(a)
    ...
    SubRoutine20(a)
    CheckIfConditionIsMet(a)
    ExitAndNotify(a)

What I need is for the script to go to the "ExitAndNotify" part if the "CheckIfConditionIsMet" returns TRUE at **any point in the process** - whether it happens on SubRoutine1, 10, or 20.

How can this be accomplished? Thanks in advance!

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.