sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #44469
[Question #660624]: app.focus() resulting in negative x and y values
New question #660624 on Sikuli:
https://answers.launchpad.net/sikuli/+question/660624
So I'm using app.focus() to focus on an application for memu, and it results in an error like this:
[error] Region(-250,-250,125,125) outside any screen - subsequent actions might not work as expected
[error] script [ C:\Users\Yongho Lee\Desktop\GFL\GFL.sikuli ] stopped with error in line 156
[error] java.lang.NullPointerException ( java.lang.NullPointerException )
[error] --- Traceback --- error source first
line: module ( function ) statement
123: main ( focus_window ) while not (memu_window.exists(Pattern('main_menu_home.png').exact())):
145: main ( collect_exped ) focus_window()
[error] --- Traceback --- end --------------
The problematic portion of the code looks like this:
def focus_window():
global memu_window
myApp = App.focus("MEmu")
memu_window = myApp.focusedWindow()
memu_window.setAutoWaitTimeout(1)
loop_count = 0
while not (memu_window.exists(Pattern('main_menu_home.png').exact())):
myApp = App.focus("MEmu")
memu_window = myApp.focusedWindow()
It's supposed to focus on the memu window and return back its coordinates to another function.
The error occurs when the code tries to initiate (memu_window.exists(Pattern('main_menu_home.png').exact())), so I'm assuming the problem here is app.focus("MEmu") returning negative values. Why does this happen and how can I fix it?
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.