← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #253723]: How to Create a Repeatable Loop

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
while True: # loop forever
    if exists(image, 0):
        click(some_image)
    wait(5)

this will look every 5 seconds and click if popup is there

Since this runs forever, it has to be stopped with the abort key or by
killing the app manually.

If there is something on the screen while running, that identifies your
main app, then this would stop automatically:

while True: # loop forever
    if not exists(imageMustBeThere, 0):
        break # end loop
    if exists(image, 0):
        click(some_image)
    wait(5)

or thinking positive ;-)

while True: # loop forever
    if exists(imageMustBeThere, 0):
        if exists(image, 0):
            click(some_image)
        wait(5)

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