← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #666773]: findAnyList() in Java

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
ok, I admit, that it is not that easy to start with SikuliX as a
newcomer to coding AND Java ;-)

The docs are primarily written for users of Python scripting and to
understand the basics of the SikuliX features.

Just some basics looked from Java:
- a Region object is where you search something in (in your case: new Region(20, 20, 100, 50);)
- the search methods are basically find, wait and exists and more complex findAll, findAny ...
- the result (return value) of these features is a Match object or a list of Match objects

So if you want any search result it always is
Match match = someRegion.find(someImage); // or wait or exists
or
List<Match> matches = someRegion.findAnyList(imageList);
...where 
List<Object> imageList = ... an ArrayList of Strings (images) and/or Pattern objects

... and then for findAny
for (Match match : matches) {
    // do with match what is needed
}

To get on the road generally:
- use the latest version 1.1.2 (http://sikulix.com)
- read across the docs, to get an idea of the features (http://sikulix-2014.readthedocs.io/en/latest/index.html)
- to "translate" a scripting feature to Java there are some hints in the docs, but finally you have to look at the method definition either in the javadocs (https://raiman.github.io/SikuliX1/javadocs/overview-summary.html) or even in the code (https://github.com/RaiMan/SikuliX1). This is usually available anyways, when you program with a mature IDE like Eclipse or IntelliJ IDEA.

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