Keyboard Maestro has the ability to create macro action sequences by recording your actions.
For example, to create a macro that simulates keystrokes, rather than create each macro action individually you can enable recording and then simply type the keystrokes.
Keyboard Maestro can record the following actions:
There are two ways you can use recording: when creating or editing a macro, or via a Record Quick Macro action.
When you are creating or editing a macro, with the Macro Editor window displayed, simply click the Record button. After a short pause for you to get ready, recording will begin. To avoid the pause, hold the option key down while clicking the Record button).
Once recording starts, demonstrate the task you would like to perform using any of the above actions and Keyboard Maestro will record your actions directly into your macro.
While Keyboard Maestro is recording, it will display the Recording window.
While you are recording, you can pause the recording by clicking the Pause button in the recording window.
Normally, Keyboard Maestro does not record pauses between actions, so the macro will play back at fast speed. However, you can add a 0.25 second pause to your macro by clicking the Clock button, or you can option-click the Clock button to turn on “real time”, and Keyboard Maestro will record a pause between each action which will simulate playback at approximately the same speed as you recorded.
When you are finished, click the Record button again to stop recording, or you can stop all recording by clicking on the Recording window.
Typically you will need to make a few adjustments to the Macro Actions to ensure the macro will operate robustly when used. Generally, use recording to create a base sequence of actions and then adjust as necessary.
The other way to use recording is via a Record Quick Macro action. When triggered, the Record Quick Macro immediately starts recording your actions into a private macro. When you have demonstrated the sequence of actions you want, trigger the Record Quick Macro action again. The sequence can now be executed via the specified Hot Key or the Status Menu or Macro Palette. For example, if the Record Quick Macro is triggered by pressing Control-F1, and the specified Hot Key is Option-F1, then if you typed:
Control-F1, h, e, l, l, o, Control-F1
Then each time you press Option-F1, Keyboard Maestro will type “hello” for you. One common use for this is if you want to adjust a sequence of lines in a systematic way. For example, if you had a list of colors, and wanted to change them in to a list of constants, say from this:
color Red color Green color Blue
const int kRed = "Red"; const int kGreen = "Green"; const int kBlue = "kBlue";
You could do this with grep and regular expression, replacing “color (.*)” with “const int k\1 = “\1”;”, which is fine if you can remember how to do grep with regular expressions, whether it is \1 or $1, and whether the application you are in supports regular expressions or not. But perhaps a simpler way is to just show Keyboard Maestro how to do the first line and then let it do the others with a single keystroke each.
So move the cursor to the start of the first line, press Control-F1, then the sequence:
Option-Shift-Right Arrow, Delete, Forward Delete, Command-Shift-Right Arrow, Command-X, c, o, n, s, t, <space>, i, n, t, <space>, k, Command-V, =, ", Command-V, ", ;.
Finish with Command-Left Arrow, Down Arrow to carefully put the cursor at the start of the next line. Now press Control-F1 again to finish the recording, and Option-F1 twice to translate the next two lines.
Record Quick Macros can record the same set of actions that normal recording can, however because you cannot see or edit the recorded actions it is wise to keep them simple, preferably just a sequence of keystrokes. Typically, recorded Quick Macros will be used immediately and not reused, but they are saved and remain available until you record over them.