← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #658728]: How to work around an occasional image

 

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

    Status: Open => Answered

Roman Podolyan proposed the following answer:
Sorry, David, you weren't clear with requirements.
Ok, here is a version with infinite loop. 

======
# Setting similarity up for my testing purposes, you may or may not use it
Settings.MinSimilarity = 0.95

# Defining function for clicking if image present
def try_click(our_image):
        try:
                click(our_image)
        except FindFailed:
                pass

# Infinite loop, makes looking for images 1, 2 and 3 infinite
while True:
    try_click(image1)
    try_click(image2)
    try_click(image3)

    # Code for stopping the script: if it finds image 4 on screen, infinite loop stops
    # and does not search for images 1, 2 and 3 anymore
    if exists(image4):
        break
        
======

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