← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #209885]: leaving a condition

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Sikuli talks Python language, so the script must follow the syntax
needed for Sikuli scripts.

One major point is indentation to identify blocks of code after
while/for/if/else/def/... that belong together (see faq 1800)

while True:
    wait(img, forever)
    click (getLastMatch())
    wewait=5
    while wewait>1:
        md1=exists(md1)
        md2=exists(md2)
        if md1 or md2:
            wait(1)
            wewait-=1
        if not (md1 and md2):
            break # leaves inner loop (-> Label1)
        if md1:
            click(img)
            click(img)
            click(img)
        if md2:
            click(img)
            click(img)
            click(img)
            click(img)
        # end of inner loop, goback to 
        # while wewait > 1
    #Label1: here we are after inner loop ends
    # go back to while True

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