Unable to find mouse pointer when using wait()

Asked by Andrew Whalen

Hello,

I am trying to do a match on an image of my mouse pointer. However it is never found when using wait(). In the script I am creating the mouse changes from a normal pointer to a pointer with an hourglass. I have managed to capture this image by using SnagIt, and my script moves the mouse pointer ( using hover() ) to a point on the screen where the background matches the background of my captured mouse image. However when I run my script and the mouse pointer changes from a normal mouse pointer to a busy mouse pointer (with an hourglass) Sikuli it not able to find it.

Does Sikuli see the mouse pointer when doing an image search? From the other bug reports / questions on this site it wasn't so clear to me.

Thanks!

Andrew

p.s. I'm using Sikuli 1.0.0 32-bit on Windows XP and Java 1.6.

Question information

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

When taking the screenshot to prepare a find operation, the mouse pointer is ignored (means: the base image, that is searched for your probe (busy mouse pointer in your case) does not contain the mouse pointer) and hence the pointer cannot be found.

But might be a good idea, to be able to check the status/image of the mouse pointer.

If you think so: please post a request bug.

Revision history for this message
Andrew Whalen (h-andrew) said :
#2

Thanks for your reply Raimund.

I had indeed read in the other questions that the mouse pointer is not seen when taking a screen capture from the IDE. That is why I used SnagIt. However when searching for my image from within a script (using wait() for instance) the image cannot be found. Thus it appears as though Sikuli is ignoring the mouse pointer when searching the screen from within a script.

If this is not the expected behaviour I will open a bug.

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

Internally a find operation works like this:
1. a screenshot is taken ignoring the mouse pointer (which is an option of Java Robot screen capture)
2. this screenshot is taken as the base image, to search in for the given image
3. as a result a match is created containing the information, where "on the screen" the image was found
4. if not found: repeat 1 and 2 until found or we get the given timeout or standard wait time

This is the expected behavior, so to not be able to search the mouse pointer is not a bug, it is a feature ;-)

So the request bug would be, to have features to deal with the mouse pointer in a Sikuli script.

BTW: you could use SnagIt called from a Sikuli script, to take a shot containing the pointer, make up a Finder with this image and look for the pointer. You decision, wether it is worth the effort.

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

is a request bug now

Revision history for this message
Andrew Whalen (h-andrew) said :
#5

Ok, thanks. Using SnagIt is not an acceptable workaround as I would need to call SnagIt every 0.5 seconds, make a screenshot, evaluate screenshot, etc. This is very complex and fragile.

Thanks for making this a feature request.

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

--- I would need to call SnagIt every 0.5
You might just leave SnagIt open and trigger a screenshot using Sikuli. As far as I know it is possible to only capture a small region.
If possible, Sikuli makes a screenshot every 0.3 seconds. So 0.5 seconds with this solution should not be a problem.