← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #676844]: if error or cant finde image run last instruction

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
        run (ligne7 -1) or a =get ligne() ; b = a-1 ; run b
       run ( ligne7) or run a
       go to ( ligne7+1) or c= a+1 ; go to c

nice try ;-) but this is not Python script language and what you ever do
in this direction will not work,

as mentioned:
... generally there is no feature in SikuliX, that allows programmatically, to repeat a script from a specific line or repeat some lines before going on.

Using the FindFailed handler is basically a good idea, but now you have
to make your click sequence aware of it.

something like that (no guarantee ;-)

def handler(event):
    global line, lines
    global shouldRepeat
    lines = range(line - 1, 2000)
    shouldRepeat = True

lines = range(1, 2000)
while True:
    shouldRepeat = false
    for line in lines:
        click(str(line)) # will get 1.png, 2.png, ...
        if shouldRepeat:
            break
    if not shouldRepeat:
        break

... click(1.png) should not fail !

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.