[2.0.0] How to: IDE: set default image location --- experimental

Asked by xyz_User on 2019-10-27

HI Raiman , can you please tell me how i can set sikulis default location of all the images i capture, currently it saves them in he root directory of the sikuli script, i would like to specify a folder just for images.


Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

This feature is partly implemented, is experimental (not tested in all aspects, might change in future) and is not yet documented.

With latest stable 2.0.0 you can do the following:

--- with a new script
 - create a folder without extension .sikuli (example myscript)
 - in the IDE open a new tab
 - as first line add
 - save the script (menu File->SaveAs: select "as File" in Save dialog File Format dropdown)
 - name the file myscript.py and click save
 - close the tab
 - reopen (File->open) and select the file myscript.py
 - capture an image and it will be saved to the given folder from setBundlePath

from now on, if myscript.py is opened, the setBundlePath will be recognized (and of course if it is run inside/outside IDE).

the script folder might be named myscripts and can contain as many .py scripts as you like (this allows to implement Python module structures with __init__.py)

--- for an existing script existing.sikuli
 - remove the .sikuli ending from the folder
 - in the IDE open the file (see above) existing.py
 - add the setBundlePath line (see above)
 - save/reopen
... and you are there

*** One more thing ;-)
 - auto-naming of images:

in a script add a line:
newImage =

leave the cursor in that line
use the capture button to capture an image

the image will be named newImage (magic :-)

this might help if you have a naming concept for your images.

Please test.
feedback appreciated.

xyz_User (userseven) said : #2

Awesome, will report back

xyz_User (userseven) said : #3

Thank you, the image naming worked as expected. However trying to set the image to the "images" folder worked but then the project is no longer called xyzproject.sikuli

Ive tried to rename the project as a sikuli file, after that it just reverts to the original way of saving things on the same directory.

Here's what I'm trying to accomplish:

             ----- images

where "MyScript.sikuli" is the actual script and contains the MyScript.py
and the subfolder images = contains all the images of "MyScript.sikuli"

RaiMan (raimund-hocke) said : #4

yes, that is the challenge in the moment:

you have to say goodbye to .sikuli completely.

just use plain foldernames (no .sikuli) and always open/use the contained .py files.

Be aware: this is the future ;-) to see the world, as Python sees it.

xyz_User (userseven) said : #5

Sounds good, and makes sense, how do I go about compiling it into a tunable Jar. I dont see the option anymore. If I try the packed just it throws as error cant find __run.py___ or something along that line (dry not on the PC atm)

RaiMan (raimund-hocke) said : #6

see your other question about export to jar

Can you help with this problem?

Provide an answer of your own, or ask xyz_User for more information if necessary.

To post a message you must log in.