[1.1.0] Second monitor recognized but still not working --- fixed 2015-05-15+

Asked by GZ

Hi Everyone,
.
When doing even a simple thing like this:
hover(Screen(0))
wait(1)
hover(Screen(1))
wait(1)

this is what happens:
the mouse moves to the middle of the first monitor (that is on the left), then it jumps to the left of the fist monitor and moves in to the middle of the first monitor, instead of moving to the middle of the second monitor (which is to the right of the first monitor).

print Screen(0)
print Screen(1)

will return:

S(0)[0,0 1920x1080] E:Y, T:3.0
S(1)[1920,0 1920x1080] E:Y, T:3.0

My setup (might be important for trouble shooting?):
2 x 1920x1080 monitors
|1st monitor | |2nd monitor|
1st monitor is main system monitor
Sikuli IDE 1.0.1 Build 12SEP2013160242
Java Version 9 Update 45 (build 1.8.0_45-b15)
GPU Quadro K6000 Driver 333.11
OS Win7 SP1 x64

What am I missing?

Regards,
George

Question information

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

--- What am I missing?

Nothing.
It is simply, that I am in the middle of fixing the bug and it seems that I missed the fact, that I pushed some changes, that got into the nightly.

Sorry for the inconvenience.

I will add a note to the nightly.

Revision history for this message
GZ (g-zr) said :
#2

Hi RaiMan,

I see.
So the fix will be in tomorrows nightly only or will there be a patch for 1.0.1 as well?

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

should be fixed with 2015-05-15+

Revision history for this message
GZ (g-zr) said :
#4

Awesome! Thank you RaiMan, I will test it soon.

I hit a problem switching from 1.0.1 to 1.1.0 (2015.05.21 nightly):
This command is not running anymore:
openApp(r'cmd.exe /c start D:\\tempkill_files\\tempkill_new_v02.bat')

In 1.0.1 this used to open a new terminal window and run the .bat in that but at the moment in 1.1.0 it won't even execute it :(
What has changed in SikuliX that might affect this?

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

forget about comment #5.

I will make it so that openApp() and App.open() will always ignore a running instance of the app in question and hence in doubt start a new instance of the application.

If you want to deal with running apps, you have to use

myApp = App(some app)
myApp.open()
myApp.focus()
myApp.close()

will be available with build 2015-05-23+

Revision history for this message
GZ (g-zr) said :
#7

I see, ok.

So from build 2015-05-23+ I will just do openApp(r'D:\\tempkill_files\\tempkill_new_v02.bat') which will launch a new terminal window to run it in and once that is finished the window will close, like openApp(r'cmd.exe /c start D:\\tempkill_files\\tempkill_new_v02.bat') does in 1.0.1, right?

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

no, much simpler
from build 2015-05-23+ on you can do, what you used to do:

openApp(r'cmd.exe /c start D:\tempkill_files\tempkill_new_v02.bat')

Be aware:
- since you use a raw string r'…' or r"…" the backslashes need/should not be doubled.

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

I will add some comments to the docs.

Revision history for this message
GZ (g-zr) said :
#10

Brilliant, thanks a lot RaiMan!!

Revision history for this message
Martin Leidel (martin-leidel) said :
#11

I still have this issue with the latest build (nightly build from 27-June-15).

I have two displays.
Screen 1 has 1680x1050, screen 2 has 1920x1200. My main display is screen 2 which might be the problem because it can't find the image:

[error] FindFailed ( can not find 1435651177273.png in R[0,0 1920x1200]@S(0) )

Looks like the screen order is somehow mixed up?

Revision history for this message
GZ (g-zr) said :
#12

Hi Martin,

Keep in mind that the display numbers are starting at 0, so your main screen is actually screen 1.

Just for a quest test, try this:
hover(Screen(0))
wait(1)
hover(Screen(1))
wait(1)
print Screen(0)
print Screen(1)

This should move your mouse to the middle of screen 0 then to the middle of screen 1.
Also it will print you the details of those screens.

Furthermore, have you specified Screen 0 or 1 for your find command?

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

@GZ
not really ;-)

Screen 0 is always the screen, that contains the point (0,0) of the coordinate system spanned by all monitors according to their current arrangement (usually done in the system settings)

Depending on other options (Windows e.g. where the desktop is) the screen containing the (0,0) is selected.

so with Martin's problem:
Screen(0) apparently is his Monitor 2, which he says is his main monitor.

Revision history for this message
Martin Leidel (martin-leidel) said :
#14

Ah thanks for the answer.

Screen 0 is my main display, in the screen resolution manager of Windows 7 it is screen number 2.
Screen 1 is the secondary one, in the screen resolution manager of Windows 7 it is screen number 1.

That's the result:

S(0)[0,0 1920x1200] E:Y, T:3,0
S(1)[1920,150 1680x1050] E:Y, T:3,0

Revision history for this message
Martin Leidel (martin-leidel) said :
#15

Thanks Raimund, yes screen(0) is my monitor 2 but my main display. :D

Revision history for this message
GZ (g-zr) said :
#16

Obviously you're right RaiMan. :)
I was thinking less, typing more. ;)

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

ok, but does this insight now solve your problem?

BTW:
you might use
match = Screen.all().find(someImage) # might take more than 1 second though
currentScreen = match.getScreen()

… and then continue with
currentScreen.find(whatever) # gets faster now ;-)

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

@GZ
no problem. I am happy with every answer that is not mine ;-)
sometimes it might be a trigger to rethink or clarify.
keep on typing ;-)

Revision history for this message
Martin Leidel (martin-leidel) said :
#19

well....

trying: match = Screen.all().find("1435651177273.png")

I get:
[error] script [ test ] stopped with error in line 1
[error] FindFailed ( can not find 1435651177273.png in S(-1)[0,0 3600x1200] )

Revision history for this message
Martin Leidel (martin-leidel) said :
#20

Funny enough: When I open the test folder (where the image is located) in the windows explorer and select the image, so that I see a preview of it in the status bar of the explorer (same screen!), Sikuli finds it. But it does not find the real button in the lower left.

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

ok, I will just bring up my Win7 with a second monitor and try out.
Will come back as soon as possible.

Revision history for this message
Martin Leidel (martin-leidel) said :
#22

Thank you and don't feel stressed, it's not a blocker. ;)

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

--- don't feel stressed
not really ;-) but since I am just in the final phase before releasing 1.1.0 as final, every irritation with such base functions need to be tracked down.

I tested with a Win7-64 2-monitors in both possible configs:
works in all cases.

you should check your image (should have as little background as possible).

One more thing:
if the mouse pointer is over the start button, it gets brighter and is not found any longer.

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

… and the preferable way to open the star menu is simply:
type(Key.ESC, Key.CTRL)

or any of the other defined Windows shortcuts.

Revision history for this message
Martin Leidel (martin-leidel) said :
#25

Hmm, the image has very little background and it's not highlighted (no mouse over). But as I usually don't need to recognize the start button and other application buttons seem to work I think this is not an issue. I can send you the small test project, but I guess it will work on your side. Thanks again!

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

ok, zip the stuff together and send it to my mail rmhdevelop--at--me.com

Revision history for this message
Martin Leidel (martin-leidel) said :
#27

Thanks, did that!