Conduct your Mac Like a Pro!
A major feature of Keyboard Maestro is 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 button to start recording. Then demonstrate the task you would like to perform using any of the above actions and Keyboard Maestro will record your actions as a sequence of Macro Actions. When you are finished, click the button again to stop recording.
While Keyboard Maestro is recording, it will display the Recording window.
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. For example, you will likely have to switch applications immediately after clicking the button, and you may not want that recorded action. 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 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.