I'm new in Jython and Sikuli

Asked by Denis

Hello.
If some one help me with my problem - would be nice and +1 in karma.
Code with sikuli for automation install application.

- I have the following piece of code in eclipse:

from sikuli.Sikuli import *
import logging
import time
logging.basicConfig(format = u'%(filename)s[LINE:%(lineno)d]# %(levelname)-8s [%(asctime)s] %(message)s', level = logging.DEBUG)
SCREEN = Screen(0)
myApp = App("Select Setup Language")
switchApp(myApp)
i = ("D:\example\workspace\JythonSikuli\src\Images\Knopka_OK_NumberOK.png")
focusWindow = myApp
Region.click(myApp, i)

and I get the following error when running:

Traceback (most recent call last):
  File "D:\example\workspace\JythonSikuli\src\Lenguage_Select.py", line 10, in <module>
    Region.click(myApp, i)
TypeError: click(): self arg can't be coerced to org.sikuli.script.Region

Please let me know if you're having any idea of what I'm doing wrong.

Thanks a lot!

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

at least you should have a look at the docs, before using a try-and-error approach.

In any case I recommend to use the pre final 1.1.0 (http://sikulix.com)

switchApp(myApp) # should bring the window to front
wait(2) # give system some time to rearrange the GUI
focusWindow = App.focusedWindow() # the frontmost window area as Region
img = ("D:\example\workspace\JythonSikuli\src\Images\Knopka_OK_NumberOK.png")
focusWindow.click(img)

... to more efficiently act with images:
setBundlePath(r"D:\example\workspace\JythonSikuli\src\Images") # somewhere at the beginning

... and later:
focusWindow.click("Knopka_OK_NumberOK.png");

Revision history for this message
Denis (local-hero) said :
#2

Thanks RaiMan, that solved my question.