← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #237464]: issue with loop

 

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

Mark Weisler posted a new comment:
Hello Joshua,
I'm not sure I completely understand your question but below are some examples of waiting for images that might be of use to you.


m =Region(20,20,100,400)
m.highlight(1)

# testing with some image that sometimes appears in this region

while m.exists("1381968538084.png",2): # execution stays at this line until image disappears, then falls through
    print "fell through"
    # other tasks and code...
    break
print "got here"


# the if statement below could be at the "bottom" of a loop and used to either wait for 300 seconds or the appearance of the image of interest.

if m.exists("1381968538084.png",300):  # wait up to 300 secs for this image to appear then continue (maybe to top of loop) 
    print "Image finally appeared under the time limit of the if statement"
    # other tasks and code...
 print "Continuing execution..."  # you will execute this statement whether the image is found or not.

# the try/except mechanism might be useful also...
# see https://answers.launchpad.net/sikuli/+question/147486

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