Monitoring whether mouse cursor remains visible

Hi,

I’d like to try and monitor whether the mouse cursor remains visible during certain activities, but I’m having trouble capturing and detecting it.

I’ve looked through the forums and tried the suggestions I’ve found (namely, disabling rich cursors), but I am still unable to capture the mouse cursor itself as an image, and even when I use an old trick I learned (using a screenshot that contains the cursor), I am unable to detect it when I run the script.

If someone has experience with this type of operation, or a snippet of SenseTalk that would do the job (or at least illustrate how to make it work), it would be much appreciated.

I’m using the Eggplant (Green) version 4.12 (1128) and Vine Server 3.0 (1016).

Thanks,
Chris Depner

Turning off the rich cursor support is a good start. You should also go to the run options and turn off “Should reposition mouse during image search”; this will prevent Eggplant moving the mouse out of the way when it doesn’t find an image on the first pass. Then the approach I would use is to first capture an image where you want the mouse to go and use the MoveTo command to get it there (Click commands would also work). Once the mouse is where you want it, capture the same area again (this capture should include the mouse in the image). Use the imagefound function with this last image to determine whether the mouse is visible.

Thanks for the reply.

I went ahead and disabled mouse repositioning on capture, but I’m still not able to detect the cursor when searching for it. I’ve simplified the test to look for the cursor over a white background, but I’m still not able to get this to work.

When I turn off rich cursors, the cursor itself completely disappears from the viewer window of the remote machine. Is this expected?

Based on what I’ve read in the forums, I would expect that I should be unable to actually capture an image of the cursor on the remote machine, since it is being drawn locally… is that correct? If so, should I expect that capturing the mouse cursor from a screenshot would work for detecting it with an imagefound() script?

Any other ideas would be much appreciated.

Yes, you should be able to capture the cursor in an image and you should still see it when you turn off rich cursors. Make sure that the Preferences > Viewer Window > Live Mode Cursor setting isn’t set to None.

I just did a simple test script using the procedures that I outlined previously and Eggplant found the image with the cursor included in it. You will need to look for the cursor over a specific area of the screen (and not just look for the cursor by itself), which is why I recommended that you first move the cursor to a specific point and then look for it. I’m attaching two images that show what this looks like; the code that goes with these images is:

MoveTo "HomeButton"
If imageFound("HomeButtonWithCursor") then
	put "Cursor is part of image"
end if

This is intended just to show that what you are trying to do is possible.

Apologies, I am following the directions you have supplied, but when I turn off Rich Cursors in Eggplant Preferences, I do not see the cursor on the remote screen (in the viewer window), at all. I see all other screen updates fine, but the cursor simply is not displayed. When I select items like menus, the menu itself is drawn, but the cursor is not.

I have verified this same behavior with both Local Cursor and Guide Box mode for the Live Mode Cursor setting.

Perhaps I am missing something else?

I’m running this on a 10.5.6 host and 10.5.6 SUT running vine server 3.0.

One thing that occurred to me… when are Eggplant preferences changes expected to take effect? Next app launch, next viewer connection?

I’ll experiment with this and see if I find anything.

  • CD

Eggplant preference changes take effect as soon as you make them. I can’t think of any that require a restart – I think they’d be labeled as requiring one if they did.

The “Capture Screen” option also does not show the mouse cursor when viewed. Is there anything else I might be missing that is preventing me from seeing/capturing the mouse cursor via the viewer window?

This ability wouldn’t be restricted to the full version of Eggplant would it? I’m currently using the trial “Green” version.

  • CD

I’ve tried and tried, but under no circumstances can I make the mouse cursor appear in the viewer window with Rich Cursors turned off. Obviously it seems possible since you were able to accomplish it in your example, but for some reason I am just unable to reproduce your success. I’ve looked at all the relevant preferences and everything seems to be set as you have suggested.

I am at a loss. Any further suggestions would be very much appreciated.

Thanks,

  • CD

I just tried it as well, and it worked for me.

Verify that you have this line included:

Set the ShouldRepositionMouse to False

so that the mouse doesn’t run offscreen. I use this all the time, and look for tooltips by moving the mouse over things.

v

I have tried that as well…

See, the thing is, when I disable Rich Cursors, I don’t see the cursor AT ALL on the SUT in the viewer window. I can move the mouse on the actual SUT using it’s mouse, but it just doesn’t show up at all in the viewer window (capture or viewing modes). Everything else updates (I can see the effects of clicks, drags, etc), but I never see the cursor moving.

When I go to capture a section of the SUT’s screen that contains the mouse (with mouse repositioning disabled), that section comes up blank. I have also tried using ARD as the VNC host and encounter the same issue.

Perhaps this is some kind of bug, or a limitation of Eggplant SE, as it appears other people can get this working just fine. I’m just not sure what else to try.

  • CD

I think I missed something obvious – I’m connecting to a second user on my own machine, not to a separate Mac. You are correct. When you connect to a separate Mac you cannot capture the mouse cursor; it’s not part of the display buffer. I apologize for keeping you on a wild goose chase – I did try this against a separate Windows machine and it worked, and I tried it against a sub-SUT (a second user on my Eggplant machine). So, the answer for you may be to create a second user on your Eggplant machine (if you don’t already have one), turn on Fast User Switching, switch to that user, launch the VNC server from that user account, then switch back to your main user account and connect to that VNC server from Eggplant. You can then run your app under that second user account and script against it (including the mouse cursor) with Eggplant.

Ahhh! Excellent. Thanks for the explanation. I will give this a shot and report back.

  • CD

Yep. That worked out just fine. I was able to use another user on the same Mac, as well as a Windows machine as SUTs and successfully captured the mouse cursor.

Thanks for the help, and patience.

  • CD