February 20, 2014

How to make a Mouse Macro

Filed under: — Marcus Tettmar @ 2:34 pm

What is a Mouse Macro?

A mouse macro is just a sequence of mouse events – mouse moves and clicks – that you record against an application window or set of windows and then play back to have that sequence of mouse events repeated.

How do I make a Mouse Macro?

A quick and easy way to create a mouse macro is to use the Macro Recorder as a Mouse Recorder. Alternatively you can write the code yourself and/or use the Mouse Action Wizard in the script editor.

Using the Macro Recorder as a Mouse Recorder for Mouse Macro Creation

After starting Macro Scheduler click on the Macro Recorder icon in the toolbar.

Before starting your recording you can tell the macro recorder which application to start. This will ensure that this application is always started when you play back your macro and therefore ensures the same starting point each time. Alternatively you may want to click on a window or double click a shortcut but remember that those clicks will also be recorded.

Stop the recording using the stop hot key (the default is ctrl-alt-s) and your macro will be created. To play back select it and click Run.

For more info on using the macro recorder see: Using the Macro Recorder

Using the Mouse Action Wizard

In the script editor under the Code Builders pane you will find the Mouse Action Wizard beneath Mouse Commands. This wizard allows you to identify a cursor position (absolute or relative) and tell the macro what to do when the position is found. Alternatively you can identify an object by windows classname or via image recognition.

For more help see the Mouse Action Wizard video.

Creating Mouse Macros Manually

It is actually surprisingly simple to write macro code by hand that automates mouse events. You will see a list of possible functions under the Mouse Commands section of the code builder and each one will open a code builder window to help you write code. But you can type the code yourself if you want. Here’s a quick example:

MouseMove>60,100
LClick

Here we see two simple commands. The first moves the mouse to screen position 60,100 and the second issues a left click.

There are self explanatory mouse macro commands to simulate all the possible mouse key click combinations and commands to move the mouse to absolute screen positions or positions relative to the active window.

For help see the Mouse Commands section of the help file.