← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #245030]: Screen(1) doesn't seem to work.

 

Question #245030 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/245030

    Status: Needs information => Open

Greg Howell gave more information on the question:
Thank you for all the responses.

So it appears to find the screens correctly like you said and maybe it
had something to do with restarting (although I thought I did that
several times before), but the problem really isn't with the screen
location and highlight now as much as it is with the way it observes and
does actions over on Screen(1).

Here's what I'm seeing:

[log] highlight S(0)[0,0 1920x1080] E:Y, T:3.0 for 3.0 secs
[debug] Screen.capture: java.awt.Rectangle[x=0,y=0,width=1920,height=1080]
[debug] RobotDesktop: captureScreen: on 0 using java.awt.Rectangle[x=0,y=0,width=1920,height=1080]
[log] highlight S(1)[-1920,-120 1920x1200] E:Y, T:3.0 for 3.0 secs
[debug] Screen.capture: java.awt.Rectangle[x=-1920,y=-120,width=1920,height=1200]
[debug] RobotDesktop: captureScreen: on 1 using java.awt.Rectangle[x=0,y=0,width=1920,height=1200]
[debug] Screen.capture: java.awt.Rectangle[x=-1920,y=-120,width=1920,height=1200]

That part is working fine.  It draws the red box around each screen correctly.  Now, I have the following code to select a region over on screen(1):
scr=Screen(1)
r = scr.selectRegion("Please select the region")

[debug] CapturePrompt: Please select the region
[debug] ScreenUnion: getIdFromPoint: (1295, 87) as (-625, -33) in (-1920, -120,3840, 1200) on 1
[debug] CapturePrompt: started at (1295,87) as L(-625,-33) on 1
[debug] CapturePrompt: finished at (1905,841) as L(-15,721) on 1
[debug] CapturePrompt.close: freeing resources

That seems to capture the screen correctly on Screen(1)

But now I have code to observe changes in that region (of course my function is defined up at the top of the file):
def changed(event):
        #popup("something changed ")
        for ch in event.changes:
                ch.highlight() # highlight all changes
        sleep(1)
        for ch in event.changes:
                ch.highlight() # turn off the highlights

r.onChange(50, changed)
r.observe(10, background=False)

What I'm seeing is that it correctly observes a change in the region
over on Screen(1) where I selected, but when it highlights and shows the
contents, it is showing the contents of the equivalent region over on
Screen(0) (i.e. it takes the contents of Screen(0) in that equivalent
region and displays it in the highlighted area over in Screen(1)).  And
the other thing I tried the other day was to do a "click" or
"rightclick" operation over in that region on Screen(1) and it actually
did the click operation at the equivalent coordinates over on Screen(0)

[debug] Region: observe: starting in R[-625,-33 610x754]@S(1) for 10.0 seconds
[debug] SikuliEventManager: resetting observe states for R[-625,-33 610x754]@S(1)
[debug] SikuliXFinal: add observer: now running 1 observer(s)
[debug] Screen.capture: java.awt.Rectangle[x=-625,y=-33,width=610,height=754]
[debug] RobotDesktop: captureScreen: on 1 using java.awt.Rectangle[x=1295,y=87,width=610,height=754]


[log] toggle highlight M[-624,-32 555x656]@S(S(0)[0,0 1920x1080]) S:-1.00 Center:-347,296: true
[debug] Screen.capture: java.awt.Rectangle[x=1293,y=85,width=561,height=662]
[debug] RobotDesktop: captureScreen: on 0 using java.awt.Rectangle[x=1293,y=85,width=561,height=662]
[log] toggle highlight M[-624,-32 555x656]@S(S(0)[0,0 1920x1080]) S:-1.00 Center:-347,296: false
[debug] observe: update exit: ret: true
[debug] Screen.capture: java.awt.Rectangle[x=-625,y=-33,width=610,height=754]
[debug] RobotDesktop: captureScreen: on 1 using java.awt.Rectangle[x=1295,y=87,width=610,height=754]


-----Original Message-----
From: bounces@xxxxxxxxxxxxx [mailto:bounces@xxxxxxxxxxxxx] On Behalf Of obiwan-92
Sent: Wednesday, March 12, 2014 9:27 AM
To: Howell, Greg
Subject: Re: [Question #245030]: Screen(1) doesn't seem to work.

Your question #245030 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/245030

obiwan-92 requested more information:
Hello,

When you modify the OS screen settings, you have to restart Sikuli.
Try to do your tests again and tell me if it's better.

I try on my Win7 with two screens in different positions, without find
any trouble.

Regards.

--
To answer this request for more information, you can either reply to this email or enter your reply at the following page:
https://answers.launchpad.net/sikuli/+question/245030

You received this question notification because you asked the question.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.