User Tools

Site Tools


action:Move_or_Click_Mouse

Move or Click Mouse Action

The Move or Click Mouse action allows you to move, click or move and click the mouse using any mouse button, and optionally dragging.

You can specify modifiers such as the shift key, as well as the position, relative to any corner of the front window, the main screen, or the current mouse location, or a found image on the screen.

Examples

Simple Example: Click Mouse at Location Relative to Window

Setup of Action

As you select options further settings may become available. For example, if you click then you can also choose a button to click with and whether or not to also press a modifier key such as Control.

Mouse Operation

  • Just Move.
  • Click.
  • Double Click.
  • Triple click.
  • Release.

Mouse Button

Depends on your mouse.

  • left button (default)
  • right button
  • center button
  • button 4
  • button 5
  • etc

Modifier Keys

Select zero or more modifier keys by clicking the relevant icon:

  • Control — ⌃.
  • Option — ⌥.
  • Shift — ⇧.
  • Command — ⌘.

When a modifier key is clicked the icon is filled with blue.

X & Y Locations for Mouse Action

  • Enter Coordinates in pixels
  • Location may be absolute or relative, based on next setting.

Location Relative To

  • mouse location.
  • absolute position.
  • front window's corner (top left, top right, bottom left, bottom right).
  • front window's center.
  • screen's corner (top left, top right, bottom left, bottom right).
  • screen's center.
  • found image's corner (top left, top right, bottom left, bottom right).
  • found image's center.

To get the relative distance (offset) of the Mouse position relative to some location, like the window top, left corner, use the Get button after you have set the relative to location.

Setup and Testing

The Go and Get Buttons are used only during setup of the Action. They have no effect when the macro is executed.

  • Go button moves the mouse to the specified X & Y location.
  • Get button sets the X & Y location to current mouse position
    • Relative to the location set by the relative to popup
    • Gives you a countdown from 5 to allow time to move the mouse pointer.

Mouse Drag Options

Specify from the pop-up whether the click operation is:

  • without dragging.
  • and drag to.
  • and drag absolute.
  • and drag relative.
  • and hold.

Notes:

  1. buttons that are pressed stay pressed only as long as the macro continues to run.
  2. use the gear icon at top right of the action to select whether or not to Restore Mouse Location.

Setup of Found Image

You can also click relative to a Found Image. The image has to be unique (which includes not being visible in the action if the image is small enough not to be shrunk in the image well) otherwise Keyboard Maestro will not know where to click. If the image is not unique and you want to click on one of them, you can either use the Find Image on Screen action (which has an option to find a non-unique image) or the For Each action with the Found Images collection to find all matching images and click on them as appropriate.

Example: Click on Image in Area Relative to Front Window

See Also


Actions

Collections

Conditions

Functions

Tokens

Forum

action/Move_or_Click_Mouse.txt · Last modified: 2017/06/03 17:01 by JMichaelTX