Changing names

Hello there

Here comes a wad of gum that hopefully sticks to a wall. In ever OCD style desire to organize, I would like to add a prefix to all of the macros I have generated and even some pre- populated i.e. may be ABCD or 1234-(MACRO)


This way I can effectively separate utilities, applications, organization, and keep everything nicely organized within category even if that category is only a letter or a single number. Thus far I have been using the rudimentary approach of highlighting and manually typing everything in, well actually dictating but that's another story. So to keep it short, didn't know if it was possible to export all Mac Pros perhaps to a spreadsheet? Where I can concatenate a prefix to the macro name and then dragged them back in having a perfectly organized set of macros under one umbrella?

As always, if this has already been covered I bury my head in the sand if it has not like take credit for creative thinking and if anybody just thinks it's an overall good idea… Thanks. Looking forward to some responses

Hey Anthony,

Here's the sort of thing that can be done with AppleScript:

# Extract Macro Names to BBEdit (use the BBEdit demo if you don't already own it)
tell application "Keyboard Maestro"
   set AppleScript's text item delimiters to linefeed
   set macroNameList to (name of every macro) as text
end tell

tell application "BBEdit"
   make new document with properties {text:macroNameList}
end tell
# Rename a given macro by its original name
tell application "Keyboard Maestro"
   set name of macro "Generic-Test 01" to "myPrefix Generic-Test 01"
end tell
# Add Prefix to Names of Selected Macros
tell application "Keyboard Maestro"
   repeat with theMacro in (get selected macros)
      set oldName to name of theMacro
      set newName to "myPrefix " & oldName
      set name of theMacro to newName
   end repeat
end tell

I don't have time to elaborate at the moment, but I'll answer any questions when time permits.


1 Like