How to run sikuli script using eclipse

Asked by Nikki

I have read all the documents on using Eclipse with sikuli.
I don't understand why click and doubleClick are not recognized. I can't add images like in sikuli.
What am i doing wrong.

from sikuli import *
type("r",KeyModifier.WIN)
type("X:\Installations\Corporate")
type(Key.ENTER)
click("1443546344348.png")
type("15_01_0030")
type(Key.ENTER)
doubleClick("1443546420127.png")
doubleClick("1443466028815.png")
doubleClick(Pattern("1443466061432.png").similar(0.89))
wait(5)
click(Pattern("1443466115580.png").similar(0.92))
click("1443533244258.png")
click("1443537724829.png")
click("1443539107410.png")

Question information

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

When not running scripts from SikuliX-IDE or using SikuliX from command line (either with some external Jython or from within Eclipse/PyDev) you have to tell, where the images are stored.

respective features:
http://sikulix-2014.readthedocs.org/en/latest/scripting.html#image-search-path-where-sikulix-looks-for-image-files

Revision history for this message
Nikki (nikikimnm) said :
#2

RainMan,

So I fixed the stored image problem but I get this error:

from sikuli import *
from Lib.sikuli.Sikuli import addImagePath
from Lib.sikuli.Screen import Screen;
from _hashlib import new
addImagePath("C:\DeploymentUnit\SikuliX\Images");
Screen s =new Screen();
s.wait(1);
s.click("C:\DeploymentUnit\SikuliX\Images\DomIcon");

Encountered "s" at line 6 was expecting one of: NEWLINE

I have tried looking up this error but I can not find any solution.
I was hoping you might know why i keep getting this error when trying to creating a Screen object.

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

Uuups, are you scripting Python or is it Java, what you are doing?

... not really clear.

Supposing it is Python scripting:

from sikuli import *
addImagePath(r"C:\DeploymentUnit\SikuliX\Images") # guard the backslashes
click("DomIcon.png")

Revision history for this message
Nikki (nikikimnm) said :
#4

I tried your example above and now i get an error
undefined variable: click
undefined variable: r

Does this mean that I have not setup eclipse for sikuli correctly?
Shouldn't sikuli Libs recognized method click?

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

please clarify: Java or Python?

Revision history for this message
Nikki (nikikimnm) said :
#6

Im using Jython Interpreter

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

please look here (revised for final 1.1.0)
https://github.com/RaiMan/SikuliX-2014/wiki/Usage-in-Java-programming

... and read carefully

Can you help with this problem?

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

To post a message you must log in.