Automating Loading Remote Content in Apple Mail with Keyboard Maestro (MacSparky Labs)

There is a new feature in Apple Mail that holds off on loading remote content in new mail messages until you push a button. While I like the feature, it gets annoying when you have to mouse over to click it while your hands are happily parked on the keyboard …

This is a post for MacSparky Labs Tier 2 (Backstage) and Tier 3 (Early Access) Members only. Care to join? Or perhaps do you need to sign in?

Using AppleScript to Open a Specific Mailbox in Apple Mail (MacSparky Labs)

Shortcuts for iOS 16 is adding a feature that lets you open a specific Mailbox in Apple Mail on your iPhone or iPad. Shortcuts for Ventura, however, doesn’t have that function. What gives? Never fear. Sparky figured out a way to duplicate the feature using AppleScript…

This is a post for MacSparky Labs Level 3 (Early Access) and Level 2 (Backstage) Members only. Care to join? Or perhaps do you need to sign in?

Keyboard Maestro 10.1

This week we got another nice update from Keyboard Maestro. This update includes a ton of new support for Shortcuts integration on the Mac. I’m so happy to see Keyboard Maestro setting itself up to be a platform where you can use it’s already powerful automation alongside anything Apple adds to Shortcuts.

I’m in the midst of building an update to the Keyboard Shortcuts Field Guide. This new Shortcuts integration just got added to the menu. You can read more about the update at the Keyboard Maestro website.

Creating OmniFocus Templates with Keyboard Maestro (MacSparky Labs)

For a long time I’ve been adding OmniFocus template projects using Shortcuts. I have a few other automations that involve project creation with Keyboard Maestro, which got me thinking about adding templated OmniFocus projects via Keyboard Maestro…

This is a post for MacSparky Labs Level 3 (Early Access) and Level 2 (Backstage) Members only. Care to join? Or perhaps do you need to sign in?

Running a Shortcut from a Keyboard Maestro Script

Recently, I’ve had several nerd friends ask me about kicking off a Shortcut from a Keyboard Maestro script. You can do that using the Execute AppleScript action with the following text inside:

tell application "Shortcuts Events"
run the shortcut "Shortcut Name"
end tell

You’d need to replace “Shortcut Name” with the actual Shortcut name, while retaining the quotes. That is all it takes to launch a Shortcut from Keyboard Maestro.

Want to get better at Keyboard Maestro? I have something for you.

Automating Idea Capture with Keyboard Maestro and Obsidian (MacSparky Labs)

This is a post for MacSparky Labs Members. Care to join?

With all of these changes lately, I’ve been exploding with new content ideas. I needed a way to capture and manage them so I built a little Keyboard Maestro script to take an idea and format it into a special note, and then save the note to my Obsidian database. Here’s how I did it …

The Difference Between Keyboard Maestro and Shortcuts for Mac

I’ve had a lot of questions about the relationship between Keyboard Maestro and Shortcuts for Mac. Specifically, is Shortcuts for Mac going to replace Keyboard Maestro? In a word, no.

I’ve spent a lot of time working with Shortcuts for Mac. It’s had a rocky start, but the Shortcuts team has the right idea for Shortcuts for Mac, and they are increasingly overcoming the significant technical changes between the iPhone/iPad and the Mac. I fully expect they will get things sorted out over time, and in the end, we’ll have a stable version of Shortcuts for the Mac to go along with an already stable version of Keyboard Maestro.

Regardless, the two tools will remain very different.

If you’ve ever used Shortcuts on your iPhone or iPad, you get essentially the same toolset on the Mac with Shortcuts for the Mac. Some of the better uses of Shortcuts are for working with personal data like contacts and calendar entries. Those things are possible with Keyboard Maestro but in ways that are not nearly as user-friendly as Shortcuts. For example, I usually write AppleScripts when working with contacts in Keyboard Maestro. It can work, but it takes a lot of work.

Another thing Shortcuts is good for is inter-app automation, provided those apps have Shortcuts support. There is no faster way to create simple automations between applications than Shortcuts when you have robust built-in support in the participating apps.

All that said, Keyboard Maestro is significantly more powerful. With Keyboard Maestro, you can create conflict palettes, script menu bar selections, and do so much more that is not and never will be possible with Shortcuts. One of my Keyboard Maestro scripts looks at the website and pushes a button on the screen, no matter where it is. Don’t hold your breath for getting that feature in Shortcuts … ever.

I’ve come around to thinking a lot lately about the idea of Project Scope with regard to Apple products and software. From the outside, things are always a bit murky, but if you pay attention, you can see what they are aiming for with most of the things they make. To me, the Scope of Shortcuts for Mac is to help users create simple automations to help them be more productive with their Macs. Apple is aiming at things like opening a window or creating a calendar event. Shortcuts for Mac is not aimed at the Keyboard Maestro feature set. That is a power user thing that they’re happy to leave in the hands of Keyboard Maestro. Think of Keyboard Maestro and Shortcuts for Mac more like complementary tools. A mallet is nice. A chisel is nice. But it is all the better having both.

Using Keyboard Maestro and AppleScript to Eject External Drives

I’ve been using a laptop + monitor setup for a while now, and I like it more than I expected. The last time I tried this, I had lots of problems getting the Mac and monitor to talk to each other when I’d plug it in. I prefer to keep the laptop closed when doing this (often called “clamshell” mode), and for years macOS did not like that.

Maybe it is the Apple silicon switchover or improvements to macOS, but that’s no longer a problem. I plug it in and start typing.

However, another friction point is disconnecting. I have a Time Machine and external storage drive connected to my Mac when attached to the monitor. It’s important that I properly dismount those drives before unplugging. (Just yanking a drive out of your Mac is a terrible idea.)

So … dismounting. There are several ways to pull it off. You could go in the Finder and eject the drive under “Locations” in the Sidebar. There is a handy little Eject button next to each removable drive. (In my case, Dagobah is my Time Machine Drive, and Batuu is my extra storage.) This solution works but is tedious.

There are also some excellent apps to solve this problem. My favorite is EjectBar. This is a menu bar app that, once you click it, lets you eject from the menu bar, saving you a trip to the Finder. A power tip with EjectBar is to Command-Click the menu bar icon, and it automatically ejects all connected drives.

I wanted, however, something more automated. So I made a simple AppleScript that ejects all external drives. Here’s the script:

try
tell application "Finder"
eject the disks
display dialog “Successfully ejected disks.” buttons {“Close”} default button “Close”
end tell
on error
display dialog “Unable to eject all disks.” buttons {“Close”} default button “Close”
end try

As AppleScripts go, this one is pretty basic.

I run this script as part of a Keyboard Maestro Macro. First, it quits all applications. I do this because I have very particular screen setups when I connect to the big monitor. I prefer to close everything out when disconnecting. (I have separate scripts for setting up screens on the laptop screen or the monitor when I plug back in.) Then I eject the drives by running the above AppleScript. I use the Hyper Key plus Q to activate it (⇧⌃⌥⌘Q). I’ve also mapped it to a button on my Stream Deck, which is how I usually activate it. This is the method that has stuck with me. When I’m ready to take the laptop, I push the button, wait a moment, and then unplug and head out. It really isn’t much trouble at all.

Here’s a download link to the Keyboard Maestro Macro.

If you’d like to get better at Keyboard Maestro, I’m putting up a $5 discount code on the Keyboard Maestro Field Guide for one week. Use code KMLAPTOPWARRIOR. 🙂

And here’s a screenshot of the Macro:

Keyboard Maestro 10 Releases

Hooray! There’s a big update to Keyboard Maestro today. The new version 10 includes a pile of new features. Banner features include the ability to add data to menu bar icons, create “Favorite” actions, and subroutines. (That’s right, you can now program subroutines in Keyboard Maestro.) Below are some of my favorite new additions:

  • Added configurable Favorite Actions.

  • Added Select Macro by Name, as well as This Macro and This Macro Group options to the macro selector pop-up.

  • Added search field to macro selector pop-up.

  • Added search field to Insert All Actions, All Functions, All Tokens, and Variables menus.

  • Added Copy as Set Macro Group Enable and Toggle Macro Group actions to contextual menu for Macro Group column.

  • Support double-clicking dividers in the editor window to set the ideal size.

  • Added Edit ➤ Insert ICU Date Field menu to insert the various ICU Date components.

  • Added OCR Screen and Paste by Name to the Macro Library.

  • Added support for manipulating Keyboard Maestro Engine windows.

  • Added option to include Macro Groups in the status menu bar.

  • Added Return action to return a value from subroutine macros.

  • Several new triggers, including unlock, appearance changed, online and power status triggers.

  • Added “long press” option for Hot Key and USB Device.

  • Added support for selecting multiple files or folders in the Prompt For File action.

My congratulations go to Peter for shipping this update. I am kicking the tires on the new features now, and I will be doing a free update to the Keyboard Maestro Field Guide after the new year covering the new features.