if fail, continue another script, when done, start first again

Asked by peter hasselby

first i want to tell that im very new to this. I have only used Sikuli for 3 days, and i have never done anything like this before. so please answer in a easily understood language, if you would be so kind.

i have following script running in sikuli..

for i in range(10):
    click("1362600377681.png")
    wait(1)
    click(Pattern("B.png").targetOffset(167,-100))
    wait("lIm.png",2000)
    click(Pattern("I0.png").targetOffset(60,38))
    click(Pattern("lahIr0lIlMIM.png").targetOffset(2,31))
    click(Pattern("_i.png").targetOffset(-37,-2))
    click("1362601111532.png")
    click(Pattern("B-1.png").targetOffset(381,-95))
    wait("wm.png",2000)
    click(Pattern("lolI.png").targetOffset(59,35))
    click(Pattern("lahhr000MIME.png").targetOffset(7,31))
    click(Pattern("_L.png").targetOffset(-36,-3))
    click("1362601339995.png")
    click(Pattern("B-2.png").targetOffset(604,-91))
    wait("Antalafspill.png",2000)
    wait(1)
    click(Pattern("Antalafspill-1.png").targetOffset(56,36))
    click(Pattern("lahIr0MKOBPL.png").targetOffset(-7,30))
    click(Pattern("_iA.png").targetOffset(-36,0))
    click("1362601653653.png")
    click(Pattern("B-3.png").targetOffset(818,-97))
    wait("llollIlIwmla.png",2000)
    click(Pattern("llol.png").targetOffset(57,33))
    click(Pattern("lahIr0lIliH.png").targetOffset(2,28))
    click(Pattern("1362601791463.png").targetOffset(-36,-1))

if for an exampel, "wait("lIm.png",2000)" fails, I want it to start on another "script".

it could be like: "wait("lIm.png",2000)". failed
then: click()
          click()
          wait()
          click()
"start from beginning again"

what type of code do i need to use?

I hope you understand my quistion and are able to answer it.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

for i in range(10):
    click("1362600377681.png")
    wait(1)
    click(Pattern("B.png").targetOffset(167,-100))
    # wait("lIm.png",2000) # the following instead
    if not exists("lIm.png",2000):
        click()
        click()
        wait()
        click()
        continue # jumps back to the for
    click(Pattern("I0.png").targetOffset(60,38))
    click(Pattern("lahIr0lIlMIM.png").targetOffset(2,31))
    click(Pattern("_i.png").targetOffset(-37,-2))
.....

Can you help with this problem?

Provide an answer of your own, or ask peter hasselby for more information if necessary.

To post a message you must log in.