Problem with multi monitor setup

Asked by solid swindler

I have my monitors setup like this in windows:

[2][1]

[2] has my start menu and other items i want my script to click on

[1] in the primary display and running in portrait

When I issue a simple click(startmenu) as shown in the example the script doesn't actually do the click. It reports that it clicked on the correct coordinates, but the click doesn't actually take place. If I do run and show actions, the target of the click is correct.

Occurs with double click as well.

I already checked out the 0.10 multimonitor info as well as similar reports, none have helped.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Since I'm willing to reproduce your situation on my Win7, could you run the following script and paste the content of the message area here and tell about things happening on screen, that are not evident.

for i in range(0, getNumberScreens()):
 print Screen(i)
r =selectRegion("Pls. capture start button")
print "r: ", r
loc=Env.getMouseLocation()
print "loc: ", loc
m2=Screen(1)
m2b=m2.getBounds()
print "m2b: ", m2b
cp=(m2B.x+10, m2b.height-10)
print "cp:", cp
mouseMove(cp)
print "cp1:", Env.getMouseLocation()
mouseDown(Button.LEFT); mouseUp()
type(Key.ESC); wait(0.5)
capture r
print "start: ", m2.find(r)

Revision history for this message
Pamalite Kensington (pamalite) said :
#2

Hi,

I have the same setup, except my primary monitor has my start menu. I want to capture a screen shot on my primary, and not the secondary. I was trying to offset the capture size, but failed to do so. The following code explains:

secondary_screen = Screen(1) # has 1440x900 resolution
main_screen = SCREEN # has 1600x1200 resolution

# Trial 01: Failed; It captured from Screen(1) until a little bit of the left of SCREEN, because 1600 is more than 1440

screen_shot = capture(main_screen)

#Trial 02: Failed; It somehow offset from 0 instead of -1440

offset_x = -(secondary_screen.getX())
screen_show = capture(offset, 0, main_screen.getW(), main_screen.getH())

# Trial 03: Passed, but Not Desirable; The capture() function treats (0, 0) where Screen(1).getX() is, which is -1440.
# And because I extended the width of both monitors, it can capture SCREEN, but leaves a big black gap on the left.

extended_width = main_screen.getW() + secondary_screen.getW()
screen_show = capture(0, 0, extended_width, main_screen.getH())

# Trial 04: Passed, but Not Desirable; This is combination of both Trial 02 and 03. It managed to capture,
# but it only the pixels to the far right of my primary monitor. That means, it captured the extended desktop,
# but offset the 1440 from (0, 0) instead. So, only 160x1200 (1600-1440) if screen was captured, while the rest are black gaps.

offset_x = -(secondary_screen.getX())
extended_width = main_screen.getW() + secondary_screen.getW()
screen_show = capture(offset_x, 0, extended_width, main_screen.getH())

Please help.

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

It seems, that in general the capture(region) or capture(x,y,w,h) do not work correctly. Some internal calculations regarding position and dimension to restrict the resulting image to only one monitor are wrong.

See related bug 577610: I did not find any way to come around this problem. It has to be fixed by the developers.

Can you help with this problem?

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

To post a message you must log in.