Input - Move mouse

Declaration

<AMINPUT ACTIVITY="move_mouse" X="number" Y="number" DELAY="number" RELATIVETO="text (options)" />

Related Topics

Description

Moves the mouse pointer to the specified pixel coordinates. To capture X/Y coordinates, move the cursor to the desired area on the screen and press the INSERT key.

NOTE: Because it uses pixel coordinates instead of control locations, this action is only recommended for use if an application cannot be automated using the Interactivity - Move mouse to object action, Input - Send keystrokes action or other, more reliable Interactivity actions. This would usually only occur if the external application that is being automated did not contain standard Windows controls or did not support standard Windows conventions such as accelerator keys or hot-keys. The reason for this is that mouse movements and clicks are dependant on window positioning and screen resolution, whereas the Send Keystrokes action is not affected by this variable and the Move Mouse to Object action communicates with the target control natively.

Practical usage

Commonly used to move the mouse cursor to an X/Y pixel coordinate on the screen and normally followed by a Input - Click mouse action.

Parameters

General

Property Type Required Default Markup Description
X Number Yes (Empty) MOVEX="288" The X pixel coordinate that the mouse pointer should be moved to. To capture X/Y coordinates, move the cursor to the desired area on the window/screen and press the INSERT key
Y Number Yes (Empty) MOVEY="216" The Y pixel coordinate that the mouse pointer should be moved to. To capture X/Y coordinates, move the cursor to the desired area on the screen and press the INSERT key.
Coordinates are relative to Text (options) No Relative to foreground window RELATIVETO="window" The point of reference the specified coordinates are relative to. The available options are:
  • Foreground window (default) - Coordinates are relative to the upper-left hand corner of the window that is currently focused when the step executes.
  • Screen - Coordinates are relative to the upper-left hand corner of the screen.
  • Current mouse position - Coordinates are relative to the position of the mouse cursor when the step executes.

Advanced

Property Type Required Default Markup Description
After moving mouse, pause for (milliseconds) Number No (Empty) DELAY="2000" The amount of milliseconds to pause after the mouse cursor is moved to the specified coordinates. Adding a delay might make this action more reliable in certain situations.

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task shows use of the Move Mouse action.

Copy
<AMBROWSER URL="www.fortra.com" SESSION="BrowserLegacySession1" />
<AMWINDOW ACTIVITY="maximize" WINDOWTITLE="Fortra | IT Management Software Solutions - Internet Explorer" />
<AMWAIT SCALAR="5" />
<AMINPUT ACTIVITY="move_mouse" X="1459" Y="110" RELATIVETO="screen" />
<AMINPUT ACTIVITY="click_mouse" />