This repository has been archived by the owner on Mar 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 233
Usage in Java programming
Raimund Hocke edited this page Dec 22, 2016
·
12 revisions
Run setup with option 2 producing a sikulixapi.jar
Read about new central folder SikulixAppData
programming with Java or Java based scripting (Jython, JRuby, Scala, Groovy, Clojure, ...)
- take care, that sikulixapi.jar is in the Java classpath of your project
- you should leave the Sikuli stuff in one well defined place.
This avoids odd errors with multiple copies, when updating to new versions.
In IDE's and other situations always use references/links to the original Sikuli stuff. - the native stuff is exported at runtime to a central folder in your SikulixAppData folder
TAKE CARE on WINDOWS:
Sikuli adds this libs path to the environment at runtime.
To avoid library clashes, purge everything from system environment, that has to do with previously used Sikuli versions.
SikuliX does not need any path entries to the used Java version in the system environment. So purge these too, if not needed for other stuff than SikuliX.
Used Images:
Sikuli searches for image files in the standard in the current working directory (Java property "user.dir")
So e.g. in Netbeans you can store images in your project folder and they will be found when simply using "some-image.png". Relative pathnames are possible too (e.g. "images/some-image.png").
Find basic info in the docs
... and tons of more examples in the net - Google is your friend;-)
… but this is a simple test program as well:
import org.sikuli.script.*;
import org.sikuli.basics.Debug;
class Test {
public static void main(String[] args) throws FindFailed {
Debug.setDebugLevel(3);
Screen s = new Screen();
s.find(s.userCapture().getFile()).highlight(2)
}
}
- it gives some more debug output
- it should ask you to capture something
- … that in turn is searched on the screen
- … and highlighted if found