Skip to content

Get mouse position

Remember where the pointer is.

Where
+ Add actionKeyboard & mouseGet mouse position
Get mouse position remembering the pointer as the variable before, with the scope This run.

Get mouse position reads where the pointer is and stores it in a variable. A macro that moves the mouse around can put it back afterwards, and a script can compute a target from it.

Setting What it does
Remember as The variable’s name. It gets the position as x,y, and name.x and name.y hold the two numbers on their own.
Scope This run keeps the variable to this macro, Everywhere shares it with all macros. See variables.
  • The action is instant. Coordinates are pixels from the top-left corner of the main display, the same ones Mouse sequence takes.
  • When the position cannot be read, the action logs it and the variable keeps its old value.

Keep the pointer where the user left it while a macro clicks around:

  1. Get mouse position, Remember as before.
  2. A Mouse sequence with the clicks, ending in Move to {{before.x}}, {{before.y}}.