sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #19624
Re: [Question #233507]: Cleanest way to search if at least one image of a set is present
Question #233507 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/233507
RaiMan posted a new comment:
--- findAll/findAny from a folder of image files
... not a feature yet, but on the list for improvements for version 1.1 later this year
So what you did with your loop is principally ok.
--- an often overseen feature to avoid additional searches for the same image: getLastMatch()
... which returns the last successful match in a region
--- only for fun: an optimized version of your loop:
File path = new File("./ccleaner/icon");
File [] files = path.listFiles();
boolean iconFound = false;
for (File fIcon : files) {
Pattern ccleanericon = new Pattern(fIcon.getAbsolutePath()).similar(similarity);
int timeout = 5;
if (k.exists(ccleanericon,timeout)!= null) {
System.out.println("Found " + fIcon.getAbsolutePath() );
Match m = k.getLastMatch();
m.highlight(2);
k.doubleClick(m);
iconFound=True; // to be checked outside loop
break;
}
else {
System.out.println("Not Found " + fIcon.getAbsolutePath());
}
}
surely not tested ;-)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.