A macro to intelligently sort macro groups was created and shared by @cdthomer:
Automatically Sort Macros According to Containing Group. @cdthomer was inspired by @82Taylor's post: Request: Ability to Sort Different KM Folders Differently.
This macro group, __ Smart Sort ⌃⌘/, adds a few bells and whistles to that macro:
When a Smart Group is selected and the macro is in Smart Sort mode, the macros will be sorted intelligently. For example, if a Smart Group named Modified Today is selected, the macros will be sorted by Date Modified. This is the main function of this macro group and it preforms very similarly to @cdthomer’s macro mentioned above.
The primary macro for user interaction is Toggle Smart Sort. Smart Sort can be enabled/disabled using ⌃⌘/ or ⌃⌥⌘/.
The default configuration for Smart Sort is likely suitable from most users, however, it can be adjusted using the SETTINGS below.
When Smart Sort is disabled using ⌃⌘/, a palette that facilitates manual sorting will appear. If it is subsequently dismissed, it can be displayed again by holding the ⌥(Option key) when clicking a group.
When Smart Sort is enabled using ⌃⌘/, the sorting palette will be hidden.
When toggling Smart Sort using ⌃⌥⌘/, the sorting palette behavior is reversed, i.e., it appears when Smart Sort is enabled, otherwise it is hidden.
When Smart Sort is enabled, the intelligent sorting can be temporarily suspended by holding the ⌥(Option key) when clicking a Smart Group. The sorting palette will also appear.
The group is named __ Smart Sort ⌃⌘/ so that it appears near the top of the group list below the Smart Groups.
The intelligent sorting in Smart Sort mode can be adjusted by changing the default values for five variables. Note that these settings are lowercase Regex strings that are used in a Switch/Case action with a matches condition.
The Sort Palette initial position can be adjusted. This is the position of the top-left corner of the palette relative to the Keyboard Maestro Editor window (both in percentages).
local_Palette X :
0 = far left;
100 = far right;
local_Palette Y :
0 = top;
100 = bottom;
All persistent values are saved to a single KM Dictionary named jsTSS_dict, where js are my initials and TSS refers to the name of this macro. For more information about this approach to saving values, refer to Dialog with Dynamic Popup List.
Toggle Smart Sort is largely based off Automatically Sort Macros According to Containing Group. The author, @cdthomer, kindly tested and provided feedback for this macro.
- Keyboard Maestro, v10.0.2
- Monterey, v12.2.1/MacBookPro16,1
- Mojave 10.14.16/Macmini6,2
- Big Sur 11.6.3/iMac19,1 by @cdthomer
- High Sierra 10.13.6/iMac11,1445
1.0 - initial version
DOWNLOAD Macro File:
__ Smart Sort ⌃⌘: Macros.kmmacros (215.4 KB)
Note: This macro group was uploaded in a DISABLED state. It must be ENABLED before the macros within it can be run.