MACRO: [KMFAM] Favorite Actions and Macros v1.4 Released 2021-12-09

Hey @Tomas,

The simplest way to do that would be to create one or more template macros in a template-macro-group and then use AppleScript to emplace them.

A basic AppleScript to duplicate a given template macro to a given macro group:

tell application "Keyboard Maestro"
   set templateMacro to macro "Templates" -- uniquely named macro of macro group "Template Group"
   set newMacro to item 1 of (duplicate templateMacro to macro group "Test Group")
   select newMacro
end tell

A more sophisticated AppleScript to duplicate a given template macro to the currently selected macro group:

tell application "Keyboard Maestro"
   set selectedMacroGroupList to macro groups whose selected is true
   if length of selectedMacroGroupList = 1 then
      set currentMacroGroupName to name of item 1 of selectedMacroGroupList
      set templateMacro to macro "Templates" -- uniquely named macro of macro group "Template Group"
      set newMacro to item 1 of (duplicate templateMacro to macro group currentMacroGroupName)
      select newMacro
   else
      error "An Incorrect Number of Macro Groups are Selected!"
      beep 2
   end if
end tell

NOTE -- These AppleScripts REQUIRE Keyboard Maestro 8+.

-Chris

3 Likes