← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #685450]: [2.0.0] How to: IDE: set default image location --- experimental

 

Question #685450 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/685450

    Status: Open => Answered

RaiMan proposed the following answer:
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
setBundlePath("someFolder")
 - 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.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.