"Click" not working for Multi Screen (have workaround :-)

Asked by Mike Lee

This seems to be similar to a couple of other reports, I just want to add mine for completeness.

No click() (or similar) actions work in my current setup:

  XP Pro (service pack 2)
  IE 6
  Silverlight 4
  (using two display screens)

------using this test code----------------
def screenTest () :
  print getNumberScreens()
  print Screen(0)
  print Screen(0).exists( MY_PIC, 0 )
  print Screen(1)
  print Screen(1).exists( MY_PIC, 0 )
-----------------------------------------------

Output for executing the following:
screenTest()
click( MY_PIC )
wait(2)

2
Screen(0)[1280,0 1280x1024] E:Y, T:3.0
None
Screen(1)[0,0 1280x1024] E:Y, T:3.0
None
[sikuli] click on (67,267), MOD: 0
[sikuli] showTarget 42 242 50 50

Any ideas ?

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

the problem is, that your Screen(0) (primary monitor) does not have (0,0) as upper left.

its a bug

Revision history for this message
Mike Lee (m-lee) said :
#2

Danke Raimund, I will use the work-around below until we have a fix ...

  targ=find( ) ; targ = targ.getCenter().left(1280)

  click(targ)

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

@ Mike (and all others who stumble upon):
good idea :-)

if you need it more often, then its a good idea to wrap it up in a def():, so it would be easier to get rid of the workaround, when its fixed.

once at the beginning of a script:
multiOffset = Screen(0).width()
def multiFind(img):
    return find(img).getCenter().left(multiOffset)

So you can say where needed:
click(multiFind(image))

when its fixed, you can regex-find-replace <multiFind(image)> with <image>
(using an editor on the .py ;-)

Revision history for this message
Tsung-Hsiang Chang (vgod) said :
#4

I can't reproduce this bug on a Mac. On my Mac, Screen(0) is always positioned at (0,0).
Anyway, I will try to fix it once I can get a multi-screen configuration on a Windows.

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

Problem fixed in Sikuli X

Can you help with this problem?

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

To post a message you must log in.