Use Case
- If you have a lot of KM Macro Groups, like I do, then it can be a real pain to quickly get to the few that you most often need to edit.
- This macro lets you quickly jump to one of your Favorite Groups.
- It will select the Group, enable it, and select the first Macro in that Group (determined by your sort order)
- You can easily and quickly find/choose your Group just by typing a few characters in its name.
- If need be, you can even see a choose from a list of ALL of your Macro Groups
- Keep in mind that the KM Prompt With List action Action does NOT show any items in the list if the list is > 100 items.
As always, please feel free to post any comments, issues, and/or suggestions you may have concerning this macro.
Example Output
This is how it looks using MY Favorite Groups
MACRO: Jump To Favorite KM Macro Group [Example]
~~~ VER: 3.0 2018-08-12 ~~~
UPDATED: 2018-08-12 21:14 GMT-5
- Revised to use better method for selecting Macro Groups and Macro Column
- Added allowance for using Text Tags at end of Macro Group Name
- Credit to @ccstone for idea and method
- To use, simply put a COMMA at the end of your actual Macro Group Name, plus whatever text you want for tags or "shortcuts"
- You can use COMMAs within the real Name
- For Example:
SD, SE, BBEdit, @SD @SE
- Actual Name:
SD, SE, BBEdit
DOWNLOAD:
Jump To Favorite KM Macro Group [Example].kmmacros (14 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
ReleaseNotes
Author.@JMichaelTX
PURPOSE:
- Quickly Jump KM Editor to a Favorite Macro Group
REQUIRES:
- KM 8.0.2+
- But it can be written in KM 7.3.1+
- It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
.
- macOS 10.11.6 (El Capitan)
- KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees.
How To Use
- Activate the KM Editor
- Trigger this macro.
- It will then prompt you to select one of your favorite Groups
- Choose a Group by typing any part of its Name
- Choose [[ ALL ]] to build a list of ALL of your Groups
- The macro will then:
- Select and Enable the Macro Group
- Select the First Macro in that Group
MACRO SETUP
-
Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me. ??
.
- Assign a Trigger to this maro..
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro.
.
-
REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)- Prompt with List of Favorite Macro Groups
- Enter your list of Favorite Groups here
TAGS: @MacroGroups @Favorites @AS @KM.Editor
USER SETTINGS:
- Any Action in magenta color is designed to be changed by end-user
ACTION COLOR CODES
- To facilitate the reading, customizing, and maintenance of this macro,
key Actions are colored as follows: - GREEN -- Key Comments designed to highlight main sections of macro
- MAGENTA -- Actions designed to be customized by user
- YELLOW -- Primary Actions (usually the main purpose of the macro)
- ORANGE -- Actions that permanently destroy Variables or Clipboards,
OR IF/THEN and PAUSE Actions
USE AT YOUR OWN RISK
- While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
- If you have any doubts or questions:
- Ask first
- Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.
property ptyScriptName : "Enable & Set Focus to KM Group & First Macro"
property ptyScriptVer : "3.0" -- CHG to use new MG method
property ptyScriptDate : "2018-08-12"
property ptyScriptAuthor : "JMichaelTX"
(*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REQUIRED:
1. macOS 10.11.6+
2. Mac Applications
• Requires Keyboard Maestro 8.2+
3. Keyboard Maestro Variables
• GET (input)
• Local__KMGroup
• SET (output)
• NONE
TAGS: @Lang.AS @SW.KM @SW.KM.Editor @CAT.UI @CAT.MacroGroup @Auth.JMichaelTX
REF: The following were used in some way in the writing of this script.
1. 2016-06-21, Chris Stone, script
Set Focus to Macro or Group Name Field
CHANGE LOG:
3.0 2018-08-12
• Revise to use better method for selecting Macro Groups.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*)
---------------------------------------
-- GET KM VARIABLES --
---------------------------------------
### Requires Keyboard Maestro 8.2+ ###
set kmInst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
set kmGroupName to getvariable "Local__KMGroup" instance kmInst
end tell
if (kmGroupName = "") then set kmGroupName to "z[Examples by JMichaelTX]"
---------------------------------------
-- SELECT, ENABLE, & SET FOCUS TO KM GROUP --
---------------------------------------
tell application "Keyboard Maestro"
if (exists macro group kmGroupName) then
select macro group kmGroupName -- name or UUID
set enabled of (macro group kmGroupName) to true
else
beep
display dialog "[ERROR]
Macro Group Does NOT Exist:
" & kmGroupName with title ptyScriptName buttons {"Cancel"} default button "Cancel"
end if
end tell
--- SET FOCUS TO FIRST MACRO BASED ON USER'S SORT CHOICE ---
--- This Script Block Provided by Chris Stone (@ccstone) ---
tell application "System Events"
tell application process "Keyboard Maestro"
tell window "Keyboard Maestro Editor"
tell scroll area 2 of splitter group 1 of group 1
set focused to true
end tell
end tell
end tell
end tell
set scriptResults to "OK" & return & "KM Group Set to: " & name of oKMGrp
return scriptResults