0

How do you get the entire region for an application via Sikuli script? I am trying to get the entire window without having to find a specific screenshot image. I have the following code right now:

app = App("app.exe")
app.focus()
appwindow=app.window()
popup("["+str(appwindow.getX())+","+str(appwindow.getY())+","+str(appwindow.getW())+","+str(appwindow.getH())+"]"

The above displays "[0,0,1,1]" This is not the actual region I need.

The application in question has multiple windows, several of which have an X and Y coordinate of 0,0 - several of which do not. I just want the entire visual surface of the application. How do I get that?

Eugene S
  • 6,709
  • 8
  • 57
  • 91

1 Answers1

0

As you already found out yourself, window() method already returns a Region but in your case there are multiple windows that the application is generating.

Microsoft Windows operating environment identifies each form in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls.

To my understanding, the reason you are not getting all regions is the way window() method is implemented in Sikuli. Internally, it calls a native getHwnd(pid, winNum) method but it's incorrectly assuming that a process has only a single HWND.

Reference 1

Reference 2

Eugene S
  • 6,709
  • 8
  • 57
  • 91
  • And likewise, calling window() with a number will return the nth window under the application. It doesn't seem Sikuli providers any kind of enumerator over the list of windows, so you are left with guessing how many there are and going until you get something that is not a window. Problem is that not all the windows under the application are truly visible, and hence they have dimensions that fall outside the actual region of the application. The worst are ones that start at x=0, y=0, because they look identical to a window that is indeed anchored at 0,0 – WayneRoseberry Nov 10 '17 at 14:56