← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #169982]: while not exists(image, FOREVER) seems not to work

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Even if it would work correctly, it will never do, what you want:

while not RegionA.exists(Blue.png,FOREVER):

since exists(image, FOREVER), will wait forever until image appears, it
will not come back, if image does not appear and your script will hang
in the evaluation of the while condition.

This is better and works:

while True:
    if not RegionA.exists(Blue.png, 0): # only one try to find it
         RegionB.wait(Yellow.png,FOREVER)
         RegionB.click(getLastMatch())
    wait(1) # or some other value

The loop while True: loops forever, so you need some conditional break inside, if you do not want to kill the IDE to stop it:
if some_condition: break

--- Your problem
I will test exists(image, FOREVER). might have a problem.

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