Keyboard Maestro Editor Megathread

Hi, @cdthomer. Good catch!

Looky here, I had set these in the macOS System Settings (likely many months ago when they were still callel the macOS System Preferences).


BTW, Apple, please, please, please give us back the System Preferences? The new (and ugly) System Settings have caused nothing but heartache.


Sorry about confusion that I likely caused above. I will update my earlier posts. Thanks, @cdthomer!

3 Likes

Haha no worries, I initially thought maybe I had setup different keyboard shortcuts in the os preferences. :sweat_smile:

I use System Keyboard Preferences (Setting) this way for most application menu commands whose keyboard shortcut I want to change.

Some people are fine with using a KM select-menu macro, but I like to be able to look in the menu and see the keyboard shortcut. I also like the fact that they work when Keyboard Maestro isn't running.

2 Likes

Agree, @ccstone, but now that I look at my MBPro System Settings, I see that I haven’t set up as many I’ve done on my Mac mini (running Mojave). Can I blame Apple for the butt-ugly System Settings?

Largely an advantage, but sometimes users forget that a keyboard shortcut isn't a default for the app. :joy:

You do that? :open_mouth:

1 Like

That’s sacrilege around here. :sweat_smile:

3 Likes

Hell, yes!

Rarely if ever by choice...

:sunglasses:

3 Likes

Good to always remind people of that site; I have it in my Favorites.

Too bad Apple doesn’t provide some bounty for bug discovery and reporting. (The bugs in iOS Shortcuts: :scream:. My index finger is still sore.)

1 Like

Automating the Keyboard Maestro Editor with AppleScript

The thread Automating the Keyboard Maestro Editor with AppleScript includes a wealth of information.

1 Like

Thank you for that kick in the pants. I've been meaning to change that for months -- ⌘R is so ingrained as "Run" that I'm forever starting a recording by mistake. No more!

3 Likes

Oops. Me too. Never mind ...

1 Like

Move Macros to TEST GROUP

Handy when you've downloaded and installed macros from the forum. Select them and trigger this macro, which will move them to a group of your choosing and delete the group they were in if it's now empty. It will then navigate to your nominated test group and enable the macros that have been moved. It comes set to move to TEST GROUP by default (green action).

Move Macros to "TEST" Group.kmmacros (58 KB)

Macro screenshot


If you'd like to auto-import downloaded macros to your test group, this macro runs the one above as a submacro:

Auto-Import Downloaded Macros to TEST GROUP.kmmacros (50 KB)

Macro screenshot

Change the folder trigger to your downloads folder and the group name in the green action.

6 Likes

Indeed, very handy when lazy people like me leave the macros in my own groups when uploading. Sometimes I leave them there because it's instructive, but usually I'm just lazy.

Thanks, @noisneil. Immediate download!


UPDATE: I see this macro uploads to the Keyboard Maestro group. That makes perfect sense!

On my system, I moved it to the .KM ⚪️ group. I like to keep the group names short and have the permanent groups sort to the top, thus the . prefix. The ⚪️ suffix indicates that the macros in the group only trigger when that particular application, Keyboard Maestro in this case, is active.

What conventions do others use?

1 Like

Super Cool!

Downloaded and used already.

Where did you get this UI info to write the AppleScript?

Thanks

1 Like

UI Browser

3 Likes

Updated with auto-import option above.

1 Like

MACRO: Sort Macros Conditionally, v3.0

Keyboard Maestro Export


Download: Sort Macros Conditionally.kmmacros (53 KB)

Documentation

PURPOSE

When this macro is triggered, the macros in the selected Macro Group or Smart Group will be conditionally sorted. The conditions, based on the name of the group, can be optionally adjusted using settings for Date Created, Date Modified, Date Used, Size, and/or Trigger. If none of the configured conditions are met, the macros will be sorted by Name.

If the hot key trigger includes the Option and Shift keys (⌥⇧), or if ⌥ and ⇧ are down when the macro is triggered, the View>Sort Macros by>Disabled to Bottom menu item will be selected if it is not already checked. Conversely, without the ⌥⇧ modifiers, View>Sort Macros by>Disabled to Bottom will be deselected if it is checked.

SETTINGS

The conditional sorting can be adjusted by changing the values for five macro settings. Note that these values should be configured using regex patterns. Match checks within the macro are case insensitive.

The default values for the five settings as follows:

local_SortByCreated
create

local_SortByModified
modif[iy]|date

local_SortByUsed
use|execute|run

local_SortBySize
size|large|big

local_SortByTrigger
trigger|hot\s?key

RELATED MACRO

This macro is designed to intelligently change the View>Macros Sort by selection; it will remain this value until:

• this macro is run again, or
• the Keyboard Maestro editor menu value is manually changed.

For conditional sorting that occurs continuously, see Toggle Smart Sort.

TESTED WITH

• Keyboard Maestro 11.0.3
• Sequoia 15.3 (24D60)/MacBookPro18,2
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445

VERSION HISTORY

1.0 initial version

1.1
When ⌥⇧ is used for Disabled to Bottom:

a) changed toggle to set, and

b) added a low volume sound (Funk) when it is checked.

2.0
a) Changed method to detect the Group name (from using %WindowName%1% to AppleScript). This enables the macro to function as expected if a group is selected, even if it is not focused.

b) Changed ⌥⇧ logic: if selected, mark Disabled to Bottom; if not selected, unmark Disabled to Bottom.

c) Removed low volume sound (Funk).

3.0
a) Regex pattern checks are now case insensitive.

b) Moved documentation from a header comment to the Keyboard Maestro forum. This has two advantages: i) reduces the size of the macro, and ii) streamlines maintenance of the macro.

c) For conditional steps that contain simple conditions, converted If Then Else actions to Switch/Case actions. When it can be used, the latter action has two advantages: i) it occupies less vertical space in the KM editor, and ii) if the logic does not have a false branch, then the action can be configured to have only a true section.


Macro-Image


2 Likes

I've updated Navigate to Configured Macro or Subroutine to Version 2.0:


On a related note, for the Execute a Macro and the Execute a Subroutine actions, @peternlewis informed me that there is a native feature of the Keyboard Maestro editor that navigates to the configured macro or subroutine:

  1. In the action, click the macro or subroutine name.

  2. On the right or left side of the selected macro, a Select Macro, a pop-up will appear.

  3. Click the Select Macro pop-up and the Keyboard Maestro editor will open the macro or subroutine.


I somehow overlooked this native feature :flushed:. But as one that has suffered from ergonomic pain related to mouse overuse, I prefer to use Navigate to Configured Macro or Subroutine since it is primarily driven by the keyboard. In addition, this macro has the capability to navigate to a macro specified in an Open a URL action.

4 Likes

I've updated Sort Macros Conditionally to Version 2.0:

  • Changed method to detect the Group name (from using %WindowName%1% to AppleScript). This enables the macro to function as expected if a group is selected, even if it is not focused.

  • Changed ⌥⇧ logic: if selected, mark Disabled to Bottom; if not selected, unmark Disabled to Bottom.

  • Removed low volume sound (Funk).

1 Like

I've updated Search All Macros to Version 2.0:

  • Added a field for Additional Qualifiers.

  • Dialog notes improved.

  • Dialog can be dismissed using the esc key.

  • Inexplicably, extraneous characters sometimes appear in the Search field when the Find in All Macros… menu item is selected. The macro will now delete such characters.

1 Like

I've updated Search All Macros to Version 3.0:

  • If this macro is run from another macro using the Execute a Macro action (or via AppleScript), and With Parameter is specified, the value will be deciphered via this macro’s %TriggerValue%. If it includes a 0: prefix, the dialog will be bypassed, and the text that follows 0: will be used as the search string. For example, if With Parameter is 0:used:1m, the dialog will be bypassed and used:1m will be the search string. If it does not include a 0: prefix, the values will used as the initial value in the dialog box.
1 Like