← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #180364]: How to select a particular image

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
ok, I understand.

maxWait = 30 # adjust to your needs
while maxWait > 0:
    if exists(image.png, 0): # check for image once
        reg = Region(getLastMatch())
        while reg.exists(image.png, 0): # check if image is still in same place
            wait(1) # time to be adjusted
        # loop again to check for image in another place 
    else:
        wait(1)
        maxWait -= 1

I use exists(img.png, 0), because this only searches once, so you have a
chance to influence general timing.

The workflow finds the image somewhere and waits for it to vanish in
this place and then starts all over again finding the image now in
another place.

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