Issues transferring scripts from 1.13 to 2.05

Asked by JoeBloggs

Hi Everyone,

I’ve previously been tinkering with SikuliX 1.1.3 and wrote a few basic scripts and now trying version 2.05. I'm not a developer/programmer by any description and my knowledge is limited so please forgive me if these questions below seem a bit simple and newbie'ish.

I wanted to use 2.05 because of the ability to run the script from a particular line, which would speed up my troubleshooting and script design immensely and able me to make progress a lot quicker.

But, when using 2.05 I’ve hit issues straight away before I've even had much chance to get underway.

None of the scripts I’ve previously wrote in 1.3 seem to work in 2.05. I get a few errors when Sikuli tries to find images that are found in the earlier version.

For example, a simple script such as:

find(1534932000076.png)
click(getLastMatch())
find(image2)
click(getLastMatch())

Will fail with the following error:

[error] ImagePath: find: not there: 1534932000076.png
[error] script [ sikulitemp-5934102712038413849 ] stopped with error in line 1
[error] FindFailed ( 1534932000076.png: (0x0) in R[0,0 1440x900]@S(0) )
[error] --- Traceback --- error source first
line: module ( function ) statement
1: main ( <module> ) find("1534932000076.png")
[error] --- Traceback --- end --------------

But if I re-capture the same image again in Sikuli 2.05 if finds it OK.

Previously I could get away with selecting one image after the next such as clicking on a dropdown menu image, and then selecting one of the options. Now in Sikuli 2.05 I have to put in a wait command after each image I’ve picked.

So, the above previous script will now be:-

find(1534932000076.png)
click(getLastMatch())
wait(1)
find(image2)
click(getLastMatch())
wait(1)

Also, when using the IDE if I try and copy ‘code’ from an old 1.3 script to a new blank script (or a newly created 2.05) one I get the following error:
[error] EditorPane: MyTransferHandler: importData: Problem pasting text
Null
I can cut and paste, code/images from scripts created in 2.05 to other scripts but nothing can be copied from my previous 1.1.3 scripts.

So, on the face of it, it looks like I have to go through manually re-typing all my scripts and re-capturing every image to be able to work with 2.05.

Any help, advice or criticism would be greatly appreciated, to get me up and running.

Thanks in advance,

Joe

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

To get an existing script running in 2.0.5 follow these steps:

- somewhere in your file system you have a folder you-name-it.sikuli, which in turn contains a file you-name-it.py (containing the script code). Folder and .py file must have the same name (you-name-it in this case).
The folder additionally contains the image files, referenced in the script code (1534932000076.png in your case)

- in the IDE use menu File -> Open, select the folder you-name-it.sikuli and click open.
now you should see your script as with 1.1.3

It should work as in 1.1.3

BTW: (for new scripts ;-)
click(someImage)

is the same as
find(someImage)
click(getLastMatch())

Revision history for this message
JoeBloggs (joebloggs999) said :
#2

Hi RaiMan,

Thank you for the quick response and the tip about not using the find(someimage). Most helpful :-)

I have now managed to go through my old scripts and found that once I'd gone through them all and cleaned them up by removing the find(someimage) elements and re-saved them with different names; that IDE 2.0.5 now see's them as valid 2.0.5 scripts. I am also now able to run them OK and copy lines from one script to another where previously I got the 'problem pasting text' error.

Hopefully now I'll be able to speed up my development with sikuli, especially with the ability to run scripts from a particular line. Next step is to rename all the .png files to more meaningful names and possibly get them centralised in one folder so that all the scripts can use them.

Thanks again,

Joe

Revision history for this message
JoeBloggs (joebloggs999) said :
#3

Thanks RaiMan, that solved my question.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

Sounds good and is a good plan.
Thanks for feedback.