← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #220729]: Errors from beginner's script

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--1. forget Sikuli executables ...
... they are just zipped .sikuli, that cannot be reopened in the IDE.

--2. Regions identical:
# a script version for Sikuli X
reg = Region(274,509,100,36)
button = Pattern("1359700184703.png").similar(0.91)
reg.click(button)
wait(1)
reg.wait(img), 180)
Region(726,181,47,38).click("L1.png")

the 2 regions you need might be calculated with respect to some fixed visual object (e.g. logo, header):
ref = find("some-ref-image.png")
buttonReg = Region(ref.x+x1, ref.y+y1, 100, 36) # x1, y1 evaluate/measure somehow
buttonReg.click(button)
This would make it independent from the app window position at runtime.

BTW: inside() is no longer needed
reg.xxx() : xxx is always inside the region

--3. running outside IDE
supposing, you have a regular Sikuli and Java installation (look http://www.sikuli.org/download.html for the latest version and faq 2005), then you can run your script from command line using 

"%ProgramFiles%\Sikuli X\Sikuli-IDE-w.bat" -s -r path-to-your-
script.sikuli

Errors will now be displayed on command line.

I guess in your case, it is a FindFailed problem at runtime.

BTW: it might be worth to have a look through the new Sikuli X docs at:
doc.sikuli.org

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.