MACRO: Macro (and macro group) renaming aid

When I post macros here in answer to someone's question, I keep a copy in Keyboard Maestro. But I almost never use these myself; they're around mainly for reference in case I want to remember how I did something.

To make it easier to keep track of these macros, I put them in their own group, and change the name to start with the date I created the macro, in YYYY-MM-DD format, like this:

I was growing tired of manually renaming these macros, so I wrote a macro to ease the task—it works on however many macros (it should also work on groups, though I didn't test it) you currently have selected. Here's how it looks in action:

Caution: Animated GIF within

rename_aid

If I press the Control key while the box is onscreen, I can enter a custom date; otherwise, today's date is used. The macro then renames the files, adding the date and divider bar to the start of each filename. Here's the macro:

Download Macro(s): Insert date at front of macro-group name.kmmacros (40 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.4.1
  • Keyboard Maestro v11.0.2

The last step in the macro is an AppleScript, which contains a section (well, two identical sections) of disabled commands:

--tell macro id uuid to set enabled to not enabled
--duplicate macro id uuid to macro group "Name of other group"
--delete macro id uuid

The first one disables each renamed macro, and the next two move it to another group and then delete the original. If you want to use these, uncomment them in both places in the macro (yes, I could have written a subroutine for this; I'm lazy and a horrid AppleScript coder), and change the name of the group to the actual group you want to move the macros into.

This is also more of a template macro for doing any sort of macro renaming task you might need to do—it could be easily modified to add things at the end, insert more dynamic information into the name, etc. For my needs, though, I love how it works—after I post a macro, I select it, hit the hot key, and it gets renamed and filed.

EDIT: The AppleScript at the end is 90% others' work. A few bits I found here on the forums, and then ChatGPT helped me with the looping syntax, which I never ever remember for AppleScript :).

-rob.

2 Likes