← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #225840]: how to do 1 scan and then click on multiple targets of the same image (about 100)?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
If you want to grab many matches of the same image at once, you have to
use findAll().

matches = findAll(Pattern("Image 1").similar(0.55))
for match in matches:
    click(match)

The returned matches are in arbitrary order. If you want them sorted
somehow:

matches = findAll(Pattern("Image 1").similar(0.55))
sorted_matches = sorted(matches, key=lambda m:m.y)
for match in sorted_matches:
    click(match)

This will go through the matches according to their y coordinate. Still
the matches having the same y value, are in arbitrary order.

One more thing: Pattern().similar(0.55)
the lower the similarity value, the higher the risk of getting false positives. A good match has a score above 0.8 or even 0.9, which depends on how much background is in the screenshot. A good screenshot has as little background as possible and concentrates on the key aspects.

more information in the docs: http://doc.sikuli.org

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