← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #204826]: Possible to do exists with a list of items?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Currently, there is not Sikuli feature to accomplish that.

So make your own def:

def clickFromList(images, reg = SCREEN):
    for img in images:
          if reg.exists(img, 0): # only one search
              click(reg.getLastMatch())
              return True
   return False

# usage:
images = [image1, image2, image3, ... image 37]
while not clickFromList(images): pass # will loop until one is found and clicked

This is a basic solution, that will click on the first one, that is
found and then terminate.

But be aware:
even with the trick exists(img,0), which will make only one search trial, with the current implementation (even if you restrict the search area to the smallest possible) each unsuccessful find will last 0.3 seconds (with the standard waitScanRate=3.0).
If you search the whole screen this might be 0.5 and more.

So if you need speed, you might try to delegate the searches to threads.

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