Dr. Drang gets a gold star for creating a date calculator in Keyboard Maestro. I’ve built a lot of date calculators over the years using various automation engines. (Shortcuts make it trivial.) I’ve always avoided the attempt in Keyboard Maestro, however, because Keyboard Maestro isn’t particularly good at working with dates. Things got better with version 10 and into the breach ran Dr. Drang.
Posts Tagged → keyboard maestro
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.
StreamDeck + Keyboard Maestro with KMLink
The Stream Deck already has a built-in plug-in for running Keyboard Maestro. It’s great and lets me run Keyboard Maestro scripts from my Stream Deck. However, it can also be tedious in that it requires me to hard link specific buttons to the Stream Deck and if I want to move a button, I’ve got to get past a bunch of friction. If I want to move the button, I needed to change the Keyboard Maestro entry. That’s no fun.
Lately I’ve been just using the independently developed KMLink instead. The script looks at your Keyboard Maestro library and lets you attach a specific script to the button. You can also add a custom icon. Once you add it to your Stream Deck setup, you can move the button around the Stream Deck without any complicated remapping.
If you are combining your Stream Deck with Keyboard Maestro, you’ll want to check this out.
Sign Up for My Free Keyboard Maestro Webinar
For some time now I’ve been trying to increasingly work with my technology in terms of contexts, not apps. I don’t want to open the Mail App to check email. Instead, I want to open the mail app to look at my legal inbox and nothing else. I don’t want to open Safari to a home page. Instead, I want to open Safari to the specific page on my learn.macsparky platform that lets me manage customer support issues. Staying in context means avoiding getting sidetracked. It means checking the email in one account and not crashing into my email from every account. It means fixing a customer support problem without getting trapped by surfing dogs. (Yes. There are surfing dogs, and I love them.)
This idea started for me on the iPhone and quickly found its way to the iPad, using Shortcuts. Over the last few months, I’ve implemented this context-based computing on my Mac and it’s glorious. I’m pulling it all off with Keyboard Maestro. There are three areas in my life: Personal, MacSparky, and the legal practice. With just a few keyboard shortcuts I can perform all of my most common tasks in each area of my life in context using Keyboard Maestro.
Best of all, I’m going to share how I’m pulling this off in a free webinar on August 27. You can sign up now. It will be a fun event full of Keyboard Maestro scripts and tips. It will be the first Field Guide webinar and I’m putting a lot of effort into it. I hope to see you on August 27.
If you’d like to see the webinar but can’t make it on August 27, go ahead and sign up. I’ll be sending out a link to watch a recording of the webinar afterward.
The AppleScript Email Extractor
I spent several hours putting together a super-nerdy Keyboard Maestro script that saves an Apple Mail message as a PDF and then uses some AppleScript to pull data out of the message and use it in the file name. I’ve already added the video, the Keyboard Maestro Script, and the AppleScript to the Keyboard Maestro Field Guide. Below you can watch the video and download the AppleScript here.
Keyboard Maestro Script Using AppleScript to Create Contacts
Creating new contacts in Apple’s Contacts app takes entirely too much mousing, clicking, and typing. This Keyboard Maestro script combines the power of Keyboard Maestro with a little bit of AppleScript to automatically create Apple Contact cards. If you dig this, there is an offer code to get $5 off the Keyboard Maestro Field Guide, “KMMAY2020”. Enjoy.
Keyboard Maestro Script to Automate Adding Text to a Google Doc
I frequently receive email from Mac Power Users listeners with feedback on some topic we discussed during the show. If the email is something that I may want to mention on the future feedback show, I copy that email into a running Google document that we then use when planning the feedback shows.
I’ve been doing this for years manually which, for a guy who likes to brag about his automation prowess, is kind of bananas. So today I took 10 minutes and wrote a quick Keyboard Maestro script to automate this process going forward and I thought I would share it. I’m adding this to the Keyboard Maestro Field Guide but also wanted to put it out on the web for anybody else that may need something similar.