public class Sikulix extends Object
Modifier and Type | Field and Description |
---|---|
static int |
testNumber |
Constructor and Description |
---|
Sikulix() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addToClasspath(String jar)
Deprecated.
|
static String |
arrayToString(String[] args) |
static boolean |
buildJarFromFolder(String targetJar,
String sourceFolder)
build a jar on the fly at runtime from a folder.
special for Jython: if the folder contains a __init__.py on first level, the folder will be copied to the jar root (hence preserving module folders) |
static boolean |
canRun()
Can SikuliX be run on this machine?
|
static void |
cleanUp(int n)
INTERNAL USE: resets stateful Sikuli X features: ScreenHighlighter, Observing, Mouse, Key, Hotkeys When in IDE:
resets selected options to defaults (TODO)
|
static boolean |
compileJythonFolder(String fpSource,
String fpTarget)
the foo.py files in the given source folder are compiled to JVM-ByteCode-classfiles foo$py.class
and stored in the target folder (thus securing your code against changes).
A folder structure is preserved. |
static void |
endError(int n)
INTERNAL USE: convenience function: runs
cleanUp(int) , prints a message endError and terminates with
returncode |
static void |
endNormal(int n)
INTERNAL USE: convenience function: runs
cleanUp(int) , prints a message endNormal and terminates with
returncode |
static void |
endWarning(int n)
INTERNAL USE: convenience function: runs
cleanUp(int) , prints a message endWarning and terminates with
returncode |
static boolean |
exportPrefs(String path) |
static String |
getJarParentPath() |
static String |
getJarPath() |
static boolean |
importPrefs(String path) |
static Screen |
init()
call this, to initialize Sikuli up to useability
|
static String |
input(String msg) |
static String |
input(String msg,
boolean hidden) |
static String |
input(String msg,
String preset) |
static String |
input(String msg,
String title,
boolean hidden) |
static String |
input(String msg,
String preset,
String title) |
static String |
input(String msg,
String preset,
String title,
boolean hidden)
request user's input as one line of text
with hidden = true: the dialog works as password input (input text hidden as bullets) take care to destroy the return value as soon as possible (internally the password is deleted on return) |
static String |
inputText(String msg,
String title,
int lines,
int width)
Shows a dialog request to enter text in a multiline text field
Though not all text might be visible, everything entered is delivered with the returned text The main purpose for this feature is to allow pasting text from somewhere preserving line breaks |
static String |
inputText(String msg,
String title,
int lines,
int width,
String text) |
static boolean |
isOnClasspath(String artefact)
Deprecated.
|
static boolean |
isRunningFromJar() |
static boolean |
isRunningSikulixapi()
Get the value of runningSikulixUtilapi
|
static String |
load(String fpJar)
add a jar to the scripting environment
Jython: added to sys.path JRuby: not yet supported JavaScript: not yet supported if no scripting active (API usage), jar is added to classpath if available |
static String |
load(String fpJar,
String fpJarImagePath)
add a jar to the scripting environment or to classpath
Jython: added to sys.path JRuby: only added to classpath JavaScript: only added to classpath if no scripting is active (API usage), jar is added to classpath if available additionally: fpJar/fpJarImagePath is added to ImagePath (not checked) |
static void |
main(String[] args)
checking parameter -d on commandline
0 - list all available tests 1 - run all available tests n - run the test with that number if available |
static boolean |
popAsk(String msg) |
static boolean |
popAsk(String msg,
String title) |
static void |
popError(String message) |
static void |
popError(String message,
String title) |
static String |
popSelect(String msg,
String[] options) |
static String |
popSelect(String msg,
String[] options,
String preset) |
static String |
popSelect(String msg,
String title,
String[] options) |
static String |
popSelect(String msg,
String title,
String[] options,
String preset) |
static void |
popup(String message) |
static void |
popup(String message,
String title) |
static String |
prefLoad(String key)
retrieve the value of a previously stored a key-value-pair from Javas persistent preferences storage that is used
by SikuliX to save settings and information between IDE sessions
|
static String |
prefLoad(String key,
String value)
retrieve the value of a previously stored a key-value-pair from Javas persistent preferences storage that is used
by SikuliX to save settings and information between IDE sessions
|
static void |
prefRemove()
permanently remove all previously stored key-value-pairs (by prefsStore()) from Javas persistent preferences
storage that is used by SikuliX to save settings and information between IDE sessions
|
static String |
prefRemove(String key)
permanently remove the previously stored key-value-pair having the given key from Javas persistent preferences
storage that is used by SikuliX to save settings and information between IDE sessions
|
static void |
prefStore(String key,
String value)
store a key-value-pair in Javas persistent preferences storage that is used by SikuliX to save settings and
information between IDE sessions
this allows, to easily make some valuable information persistent |
static String |
run(String cmdline) |
static String |
run(String[] cmd) |
static void |
setRunningSikulixapi(boolean runningAPI)
Set the value of runningSikulixUtilapi
|
static void |
terminate(int n) |
static boolean |
testSetup()
INTERNAL USE: used in setup: tests basic SikulixUtil features
|
static boolean |
testSetup(String src)
INTERNAL USE: used in setup: tests basic SikulixUtil features
|
static boolean |
testSetupSilent()
INTERNAL USE: used in setup: tests basic SikulixUtil features
|
public static void main(String[] args) throws FindFailed
args
- currently only -d is evaluatedFindFailed
public static String load(String fpJar)
fpJar
- absolute path to a jar (relative: searched according to Extension concept,
but first on sys.path)public static String load(String fpJar, String fpJarImagePath)
fpJar
- absolute path to a jar (relative: searched according to Extension concept,
but first on sys.path)fpJarImagePath
- path relative to jar root inside jarpublic static boolean buildJarFromFolder(String targetJar, String sourceFolder)
targetJar
- absolute path to the created jar (parent folder must exist, jar is overwritten)sourceFolder
- absolute path to a folder, the contained folder structure
will be copied to the jar root levelpublic static boolean compileJythonFolder(String fpSource, String fpTarget)
fpSource
- absolute path to a folder/folder-tree containing the stuff to be copied/compiledfpTarget
- the folder that will contain the copied/compiled stuff (folder is first deleted)public static boolean isRunningFromJar()
public static String getJarPath()
public static String getJarParentPath()
public static boolean isRunningSikulixapi()
public static void setRunningSikulixapi(boolean runningAPI)
runningAPI
- new value of runningSikulixUtilapipublic static Screen init()
public static boolean canRun()
public static void endNormal(int n)
cleanUp(int)
, prints a message endNormal and terminates with
returncoden
- public static void endWarning(int n)
cleanUp(int)
, prints a message endWarning and terminates with
returncoden
- returncodepublic static void endError(int n)
cleanUp(int)
, prints a message endError and terminates with
returncoden
- public static void terminate(int n)
public static void cleanUp(int n)
n
- returncodepublic static boolean testSetup()
public static boolean testSetup(String src)
public static boolean testSetupSilent()
@Deprecated public static boolean addToClasspath(String jar)
@Deprecated public static boolean isOnClasspath(String artefact)
public static void popError(String message)
public static String input(String msg, String preset, String title, boolean hidden)
msg
- preset
- title
- hidden
- public static boolean popAsk(String msg)
public static void popup(String message)
public static String inputText(String msg, String title, int lines, int width)
msg
- the message to display.title
- the title for the dialog (default: Sikuli input request)lines
- the maximum number of lines visible in the text field (default 9)width
- the maximum number of characters visible in one line (default 20)public static String inputText(String msg, String title, int lines, int width, String text)
public static boolean importPrefs(String path)
public static boolean exportPrefs(String path)
public static void prefStore(String key, String value)
key
- name of the itemvalue
- item contentpublic static String prefLoad(String key)
key
- name of the itempublic static String prefLoad(String key, String value)
key
- name of the itemvalue
- the item content or the given value if not stored yet (default)public static String prefRemove(String key)
key
- name of the item to permanently removepublic static void prefRemove()