Home > Language Reference > Windows Management Functions > MoveMouse

MoveMouse

The MoveMouse function moves the mouse pointer to the specified pixels coordinates.

Usage

Used to highlight a text selection or to draw lines. Low level Recording mode generates a lot of MoveMouse lines as recording is done at pixel level and not at Windows object level.

Syntax

MoveMouse(<x>, <y> [, Absolute])

Parameters

<x>,<y>, integer, x,y pixel coordinates that the mouse pointer has to be moved to.

Absolute, optional keyword indicating that the coordinates are relative to the topleft of the screen instead of the topleft of the window.

Remarks

If no previous UseWindow line indicates the window name where the MoveMouse must be done, an error is reported and script execution stops.

See also

ClickMouse

Examples

MoveMouse(100, 200)


'This script launches MsPaint and draws a rectangle.
'Launch Mspaint
shell("mspaint",3)
'Select the Pencil tool - mouse coordinates are used as the tool is an icon within any text
UseWindow("MSPAINT.EXE|NetUIHWND|Untitled - Paint|1")
 ClickMouse(Left,Down,250,70)
 ClickMouse(Left,Up,250,70)
'Using Pencil tool, draw a line
UseWindow("MSPAINT.EXE|Afx:|Untitled - Paint|1",1)
 ClickMouse(Left,Down,234,99)
 MoveMouse(234,100)
 MoveMouse(238,106)
 MoveMouse(252,126)
 MoveMouse(274,155)
 MoveMouse(303,190)
 MoveMouse(326,221)
 MoveMouse(348,249)
 MoveMouse(372,276)
 MoveMouse(402,306)
 MoveMouse(426,327)
 MoveMouse(444,344)
 MoveMouse(472,365)
 MoveMouse(507,387)
 MoveMouse(533,405)
 MoveMouse(559,423)
 MoveMouse(578,436)
 MoveMouse(594,445)
 MoveMouse(603,449)
 MoveMouse(606,449)
 MoveMouse(607,449)
 ClickMouse(Left,Up,607,449)