[1.0] Error: Region outside any screen ... How to handle?

Asked by RaiMan

*** workaround in the related bug report
----------------------------------------------------------------------------------

taken from: https://answers.launchpad.net/sikuli/+question/229398

  reg = App('Microsoft Word').window(0)

  #Look for text
  reg.wait('Home')

Making more tests in the IDE, I have this error when the window is maximized:

  [debug] getWindow: java.awt.Rectangle[x=-4,y=-4,width=1448,height=908]
  [error] Region (1448, 908) outside any screen - subsequent actions might not work as expected
  [error] script [ TestText ] stopped with error in line 6
  [error] FindFailed ( null )

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
RaiMan (raimund-hocke) said :
#1

I divide the question in 2

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

Pls. check what happens using this:

reg = Region(App('Microsoft Word').window(0))

Revision history for this message
Ricardo Cardona Ramirez (ricardona) said :
#3

RaiMan,

With the new script:

  reg = Region(App('Microsoft Word').window(0))

  #Look for text
  reg.click('Home')

I get the same error, but now twice:

  [debug] getWindow: java.awt.Rectangle[x=-4,y=-4,width=1448,height=908]
  [error] Region (1448, 908) outside any screen - subsequent actions might not work as expected
  [error] Region (1448, 908) outside any screen - subsequent actions might not work as expected
  [error] script [ TestText ] stopped with error in line 6
  [error] FindFailed ( null )

Thanks for your help

Ricardo Cardona

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

ok, I will check it and come back later.

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

i am working on it.

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

At least on Windows 7 we have the situation, that maximized application windows (e.g by double clicking on the title bar) are maxcimized in a way, that the window frame is put outside the physical screen.
This leads to a "negative" (x,y) point for the top left corner of the region returned by App().window() and hence to the reported error: Region outside any screen.

There is no simple automatic solution for that. I have it now on the list for version 1.1.

This you can do as a workaround until then:

reg = intersection(App('Microsoft Word').window(0))

which reduces the window region to the visible part on Screen(0) (what is the area, that is accessible for Sikuli)

Revision history for this message
Bunnings (sillybilly) said :
#7

Hi Raiman, I encountered the same issue

I have the output of the region i am after from two versions

RC3 - pt1.1: Region[-4,-4 1928x1058]@Screen(0)[0,0 1920x1080] E:Y, T:3.0 E:Y, T:3.0

1.0 - R[-4,-4 1928x1058]@Screen??? E:Y, T:3.0

Windows XP, Screen maximised

I'll will follow the workaround and see how it goes.