[1.0] Mac: DualMonitor: Capture does not use the region on the correct monitor

Asked by Sleek

--- fixed with version 1.0.1
----------------------------------------------------

Hi,

I have been using Sikuli for 2 years and I just started using the new Sikuli API for Mac. I noticed that using capture(region) does not seem to work correctly with dual monitor setup. Just wanted to find out if I am doing something wrong, although using Sikuli Script X-1.0rc3 seems to work fine with the same code.

Code goes something like this:
r = createRegion(x, y, w, h)
highlight(r) // This highlights the correct region.
capture(r) // This captures the incorrect region.

I have dual monitor setup, my OSX dock/system menu bar is on the external monitor, the region that I want to capture is also in the external monitor and calling highlight shows that. However calling the capture with the same region object uses the laptop monitor. I restarted OSX and still the same problem. Using the SCREEN constant to capture also uses the laptop monitor but in the docs its says:
"Mac: The monitor, that has the System Menu Bar, is always Screen(0) and mapped to the default SCREEN."

And like I said the same code works fine with Sikuli Script X-1.0rc3.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
RaiMan Edit question
Last query:
Last reply:
Revision history for this message
Sleek (sleekism) said :
#1

Incase it makes a difference. I am using interactive jython session from the command line.

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

I will check this today. Might be a bug.

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

I tested with version 1.0.1, which is only a few days away from release.

- Screen(0) is the monitor having the menuBar/dock

- the coordinates of additional monitors are according to their relative position to primary (left negative x-values, right positive x-values + width of primary)

- regions are correctly referenced on the screen (e.g. r.highlight(2)) and capture(r) captures the correct image as expected.

There is one problem left currently:
find only works on the primary screen. When find is advised to search on other screens or regions on other screens, the search region seems to be wrong.
I will check this further and fix it with 1.0.1

--- This was my test code:
showScreens()
r = selectRegion()
r.highlight(2)
r1 = r.grow(10)
r1.highlight(2)
img = capture(r)
print img
print r1.find(img) # this fails on Screen(1) with a search region out side any screen

Revision history for this message
Sleek (sleekism) said :
#4

Thanks RaiMan. I will get version 1.0.1 when its released and let you know how it goes.

Can you help with this problem?

Provide an answer of your own, or ask Sleek for more information if necessary.

To post a message you must log in.