← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #302259]: sikuli code repeating

 

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

    Status: Open => Answered

masuo proposed the following answer:
Use "break"  when you want to exit from loop.

[example specification]
When  image1  is  found, click image3, then end.
While image1 is not found, repeat click image2 and sleep .

[example code]
for n in range(10):
    if  not exists("image1.png",0):
         click("image2.png")
         sleep(1)
    else:
        click("image3.png")
        break

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