[request] Java: want a helper feature, to dynamically access and use the image and pattern definitions from a SikuliX script
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
In Progress
|
Medium
|
RaiMan |
Bug Description
motivated by the related question https:/
this is taken from comment #2:
This is an approach, to efficiently combine Java coding with SikuliX features and the SikuliX IDE support.
- have the complete image handling in the IDE, just setting up scripts only containing images
such a script will simply be a list of image file names.
The images are then available in the folder you-name-it.sikuli
- now you code in Java and access the images using setBundlePath() or more efficiently using the ImagePath features.
For these high level features some useable docs are available (start here: http://
One caveat:
In the IDE you have the Preview feature, that lets you adjust the minimum similarity and the targetOffset resulting in a script code with this template:
Pattern(
Pattern(
So if you use the IDE Preview feature in this case, you will not have access in your Java code to the Pattern definitions, only the images and would have to define the Patterns on the Java level again (at least copy&paste could be used).
A helper in this situation would be some Java feature like this:
a class, that creates some image/pattern container, that analyses the script.py and allows to dynamically access the definitions:
ImageContainer myImages = new ImageContainer(
and then use this:
Screen score = new Screen()
Match m = scr.find(
where for the sake of simplicity ImageContainer.
the script path-to-some.sikuli content:
somename1 = "someImage.png"
somename2 = Pattern(
... and more
which would be easy to scan using pattern matching together with some container map to store the attributes.
I guess the whole class will have about 20 - 30 lines of code and could even be used to reuse the image and pattern definitions in existing scripts, that are migrated to Java (in which case the ref-names might be the line number of the line the image ore pattern is defined if no name = is used.
I am just wondering, why not already someone has done and talked about this ;-)
Changed in sikuli: | |
status: | New → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → RaiMan (raimund-hocke) |
milestone: | none → 2.0.0 |
Changed in sikuli: | |
milestone: | 2.0.0 → 2.1.0 |
"A helper in this situation would be some Java feature like this:
a class, that creates some image/pattern container, that analyses the script.py and allows to dynamically access the definitions:"
Wouldn't it be better to just have a Jython-IDE-instance runner that could run specific .sikuli project as needed? A script to rewrite python into Java code sounds hacky. How would it handle imports? for-in loops? ifs and try-catch?