I’m trying to use MoveTo in a script but it’s not working the way I expected. I have a tab on a web page that is supposed to expand the mouse is hovering over it. So I added the following to my script:
WaitFor 8.0, “Tab1Expanded”
“Tab1” is the image for the tab and “Tab1Expanded” is the image for the expanded state of the tab when the mouse is hovering over it.
When I run the script I see the mouse flash over the tab but then it disappears and the tab never expands. How can I get the mouse to hover over the tab?
You’ll probably need to temporarily turn off mouse repositioning:
set the shouldRepositionMouse to false
This will prevent Eggplant from moving the mouse down to the corner of the screen while it’s looking for the Tab1Expanded image.
Most of the time, repositioning the mouse doesn’t cause problems, and in some situations allows Eggplant to see images that might otherwise be blocked by the mouse cursor. But for situations where the mouse must hover over an object it obviously causes problems. You can set it back to true once you finish. Or not. Most VNC servers these days send Eggplant a view of the screen without the cursor, and send the cursor separately, which allows Eggplant to find images regardless of where the mouse is positioned.
Eggplant by default repositions the mouse to (0,0) when searching for images, this cuts down on a lot of failures.
Add this line to your script before the move to:
set the shouldrepositionmouse to NO
Don’t forget to reset it afterwards.
Thanks to both of you for the replies. I have the script working now.