Stairways Software Icon

Stairways Software

Excellence In Software For Over Ten Years – Only with a Mac

Using Quick Macros

The Record Quick Macro action allows you to record a macro on the fly and then play it back multiple times. Since the recording is done ”blind”, it is best to stick to just keystrokes if at all possible.

By default, there is a Record Quick Macro action triggered by Control-F1 with play back trigger Option-F1, but you can create more than one of these to hold different recordings.

Quick Macros are incredibly helpful for re-formatting text. For example, I frequently have to turn an enumerated value into localisation strings. It can be done using a regular expression, but even for experienced users, regularly expressions are fairly fiddly to get right, and not all applications support search and replace with regular expressions.

So for example, say I have this enumerated type in my code:


and I want to generate the Localized.strings entry to match. I paste that in, and then place my insertion point at the start of the first line, and then start the recording, change the first line and leave the insertion point at the start of the next lines, something like:

Control-F1, Forward Delete, Option-Shift-Right Arrow, Command-X, Command-Shift-Right Arrorw, M e n u, Command-V, <space>, =, <space>, ", Command-V, ", ;, Command-Left Arrow, Down Arrow, Control-F1. Option-F1

Now I just press Option-F1 seven times to convert the rest of the lines to end up with:

MenuExists  =  "Exists";
MenuDoesNotExist = "DoesNotExist";
MenuIsEnabled = "IsEnabled";
MenuIsNotEnabled = "IsNotEnabled";
MenuExistsButIsNotEnabled = "ExistsButIsNotEnabled";
MenuIsMarked = "IsMarked";
MenuIsNotMarked = "IsNotMarked";
MenuExistsButIsNotMarked = "ExistsButIsNotMarked";

I can then easily edit the strings as appropriate.

Posted Wednesday, July 24, 2013. Permalink. Post a Comment.


Post Comment

Name: (optional)
URL: (optional)
Email: (optional, not published)
CAPTCHA: eight two two six (required)
  To prove you are human, please enter the number as digits (ie, 1-9).
  You can use some HTML tags such as <b>, <i>, and <a href="">.
We reserve the right to remove any offensive or inappropriate comments.
Due to spam issues, comments are initially invisible until we review them,
you can see them (background red) and we can see them, but no one else.

Comment Preview

None yet.

Buy Now

User Database