sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26847
Re: [Question #251111]: Textsearch instead of finding screenshots
Question #251111 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/251111
Status: Open => Answered
RaiMan proposed the following answer:
I just tested on Windows 8 with 1.0.1 and sikuli-java.jar (setup option
3) (should make no difference to your Windows setup)
This worked as expected in my Eclipse:
package my.Test;
import java.io.File;
import java.io.IOException;
import org.sikuli.basics.Debug;
import org.sikuli.script.*;
public class Run {
public static void main(String[] args) throws FindFailed, IOException {
Debug.setDebugLevel(3);
String wd = System.getProperty("user.dir");
Debug.log(0, "Running in: %s", wd);
Screen s = new Screen();
// absolute file path, taken as is
File img = new File(wd, "images\\1404636229697.png");
Debug.log(0, "Image absolute: %s exists: %s", img, (img.exists() ? "YES" : "NO"));
Pattern pimg = new Pattern(img.getAbsolutePath());
s.find(pimg).highlight(2);
// relative filepath, searched in working folder
img = new File("images\\1404636229697.png");
Debug.log(0, "Image relative: %s exists: %s", img, (img.exists() ? "YES" : "NO"));
pimg = new Pattern(img.getPath());
s.find(pimg).highlight(2);
}
}
The folder images is at the root level of the project folder.
I do not see any reason, why this should not work on Linux too.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.