Unable to find images on the second monitor

Asked by Vin Uppinkudru on 2018-02-08

Hi RaiMan,

Appreciate if you could help me with this question.

My monitor setup is as explained

I have a laptop with 2 monitors.

In the windows display setup, all the monitors have been setup to "Extend the desktop to this Display"

In the windows Display Setup
Monitor 3 is my main display and coordinate is (0,0)
Minotor 2 is at corodiante (1680,0)
Monitor 1 (laptop) at coordinate (0.-1360)

My screen set up as per Sikuli is as below

        System.out.println("Number of screens: " + Screen.getNumberScreens());
        System.out.println("Screen Bound screen 0: " + Screen.getBounds(0));
        System.out.println("Screen Bound screen 1: " + Screen.getBounds(1));
        System.out.println("Screen Bound screen 2: " + Screen.getBounds(2));

Number of screens: 3
Screen Bound screen 0: java.awt.Rectangle[x=0,y=0,width=1680,height=1050]
Screen Bound screen 1: java.awt.Rectangle[x=1680,y=0,width=1680,height=1050]
Screen Bound screen 2: java.awt.Rectangle[x=-1360,y=0,width=1360,height=768]

The Display setup and Sikuli program matches so far.
Step #1:
Now I place my application on the Monitor1 and run the below program
        Screen screen = new Screen(0);
        Region regConn = screen.find("C:\\Workspace\\sikuli-java-app\\src\\app\\login_connected.PNG");
        regConn.highlight(10);

The image is found as expected.

Step #2:
Now I place my application on the Monitor1 and run the below program
        Screen screen = new Screen(1);
        Region regConn = screen.find("C:\\Workspace\\sikuli-java-app\\src\\app\\login_connected.PNG");
        regConn.highlight(10);

Image is found. I am not sure why the image is found. Does this mean Screen(0) and Screen(1) are the same?

Interestinlgy
Step #3:
Now I place my application on the Monitor2 and run the below program
        Screen screen = new Screen(2);
        Region regConn = screen.find("C:\\Workspace\\sikuli-java-app\\src\\app\\login_connected.PNG");
        regConn.highlight(10);

Image is not found. I was expecting the image would be found as I had application open in monitor 2.

Can you please explain this behaviour.

My requirement is that I have 2 applications running on each of the monitors and I should be able to control the individual applications.
Thanks in advance for your kind help.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Vin Uppinkudru
Solved:
2018-02-08
Last query:
2018-02-08
Last reply:
2018-02-08
RaiMan (raimund-hocke) said : #1

What version of SikuliX?

RaiMan (raimund-hocke) said : #2

Run your program with
-Dsikuli.Debug=3

on the Java command line and report the section in the debug output, that shows the screen setup.

RaiMan (raimund-hocke) said : #3

Seeing the screen coordinates, then
- laptop is placed left (monitor 1)
- Main monitor is in the middle (monitor 3)
- Another monitor is placed right (monitor 2)

As SikuliX sees it:
Screen(0) (primary) is monitor 3
Screen(1) is monitor 2
Screen(2) is the laptop monitor 1

saying
Screen screen = new Screen(n);
screen.find(...)

should restrict the search area to the coordinates of Screen(n) and only be successful, if the target image is visible in that region.

So if you have at least version 1.1.1 run you program with the mentioned debug option.

Vin Uppinkudru (neouppin) said : #4

Thank you RaiMan.
My display configuration is exactly same as what you had mentioned in your comment #3.

I am using Sikulix version 1.0.1

I have kept my application on Monitor2.

I tried tried find with

Screen screen = new Screen(0);
screen.find(...)

Screen screen = new Screen(1);
screen.find(...)

Screen screen = new Screen(2);
screen.find(...)

None of the above could find the image.

Any clues please.

RaiMan (raimund-hocke) said : #5

Upgrade to version 1.1.1

http://sikulix.com