← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #369798]: Find an image in an other image

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
I have to admit, that the docs are not very consistent, but at least
this is clear:

The workflow always is:
- setup a Finder
- do a find or findAll operation
- check with hasNext(), wether anything was found at all
- get the available matches with next() if hasNext() says more available
- After a complete iteration, the finder object is empty.
- You can start a new find or findAll operation at any time.

so in your case:

Finder finder = new Finder(image);
finder.find(img); # the return value is not relevant (if null, then the image could not be loaded)
// the find operation and the collection of matches itself is an internal side-effect
if (finder.hasNext()) {
  Match found = finder.next();
} else {
  // not found
}

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.