← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #174000]: How to restart from the start of the loop if something goes wrong

 

Question #174000 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/174000

    Status: Open => Answered

RaiMan proposed the following answer:
Uuuups, you seem not to have much programming skills beside autohotkey.

Then Sikuli might be a challenge on one hand, but a chance on the other
hand, since the used Python language is rather easy to learn, if you
start with some basics like loops and if/elif/else constructs. Forget
def for the moment (in fact many of the usages you can see here are not
really optimal in the sense of defining and using a function).

So feel free, to send me your ideas/questions together with a zipped
version of your .sikuli to my mail at https://launchpad.net/~raimund-
hocke and I will have a look at it.

--- key strokes such as "Clt+Shift+M"
type("m", KeyModifier.CTRL+KeyModifier.SHIFT)

--- I really recommend to have a look at the docs
http://sikuli.org/docx/

---  to just restart the entire loop from scratch if something goes wrong.
a good start for loops: faq 1437
What you want is possible rather easy, but there are many ways to do that - it depends on the situation.

If you want to solve this generally for a loop:

while True: # infinite loop
    try:
        # some code that may fail with exceptions
    except:
        continue # start all over again if above code fails somehow

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