Input - Move mouse

Declaration

<AMMOUSEMOVE MOVEX="number" MOVE="number" RELATIVETO="text(options)" DELAY="number" />

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.

IMPORTANT: Because it uses pixel coordinates instead of control locations, this action is only recommended for use if an application cannot be automated using the Move Mouse to Object action, 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 Click Mouse action.

Parameters

General

Property

Type

Required

Default

Markup

Description

X Pos

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 Pos

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

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

 

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description:

This sample task shows use of the Move Mouse action.

 

<AMBROWSER URL="https://www.networkautomation.com/downloads/" />

<AMWINDOWMAXIMIZE WINDOWTITLE="Download AutoMate - Network Automation - Windows Internet Explorer" />

<AMPAUSE ACTION="waitfor" SCALAR="2" />

<AMMOUSEMOVE MOVEX="879" MOVEY="659" RELATIVETO="screen" DELAY="2000" />

<AMMOUSECLICK />