When you launch Keyboard Maestro it launches an invisible “Keyboard Maestro Engine” that continues to run even after you quit Keyboard Maestro. The engine is the process that enables your Macros, Application Switcher, and Clipboard History Switcher to work. Keyboard Maestro Control allows you to execute any Keyboard Maestro macros on your Mac as if you were sitting at your desk. This means you can perform any action Keyboard Maestro is capable of on your Mac directly from your iPhone, iPad or iPod touch. Keyboard Maestro is essentially an IDE for automation. You create macros of actions that you can then easily call from Karabiner. It has a wonderful community that is happy to help with whatever you are trying to achieve. I share all the macros I use with the app.
March 29, 2021 at 10:15 AM by Dr. Drang
The best thing about blogging your little automations is that other people see them and come up with improvements. In an article in iMagazine, Wojtek Pietrusiewicz redid my Cocoa keybindings as Keyboard Maestro macros. The article is in Polish, but you shouldn’t have any trouble getting the gist of it.
Wojtek’s macros are better than my keybindings because they work in any app, even those that don’t honor Cocoa keybindings, like Messages, Twitter, and Slack. Of course, they only work if you have Keyboard Maestro, but if you’re serious about Mac automation, you probably do.
Keyboard Maestro is a powerful macro program for Mac OS X. Keyboard Maestro will take your Macintosh experience to a new level in Ease of Use.
Wojtek does the case changing through Keyboard Maestro filters. I had never looked at Keyboard Maestro’s Filter action before. It has a remarkable list of transformations:
There are 47 filters in this list, more even than you’ll find in BBEdit’s Text menu.1 I’m not sure why I’d never noticed the Filter action before, but now that I have, I won’t forget it.
While Wojtek’s macros are an improvement on my Cocoa keybindings, they don’t replace the AppleScripts I wrote for BBEdit because they don’t handle the situation in which text is already chosen. Wojtek mentions in his article that he plans to add that ability, but I couldn’t wait. I extended his macros to work like my AppleScripts, but in any app.
Here’s the Lower Case macro. The Upper Case and Capitalize macros are the same except for the filter.
The first thing it does is save whatever you have on the system clipboard. We’ll restore that at the end of the macro. It then initializes the clipboard with an empty string—this is necessary to work with the logic of the later steps.
The next step is to simulate a ⌘C keystroke. If there’s text selected, it gets put on the clipboard; if there’s no text selected, the clipboard remains an empty string.
Now we test the contents of the clipboard. If it’s an empty string, we simulate a ⌥⇧← keystroke to select back to the beginning of the word and a ⌘C keystroke to put that text on the clipboard. If the clipboard is not an empty string, we do nothing.
As we leave the macro’s conditional chunk, whatever text we want to change the case of is both selected and on the clipboard. The next two steps change the case of the clipboard and paste it in to replace the selection. Finally, we restore the clipboard to what it was before we started.
Thanks to Wojtek, I now have a set of case-changing macros that work consistently in every app.
Ultimately, I’d say BBEdit wins because a couple of its Text menu items allow you to filter text through any Unix command or script that you’ve written. ↩
I’ve previously written about the Mac keyboard shortcuts I use most often, and also talked about being productive on a small screen. Productivity (and avoiding the mouse or trackpad) is very important to me, and to that end I use a macro utility on my Macs called Keyboard Maestro.
Keyboard Maestro can do just about anything, including complex, multi-step automations, scripting, interface control, periodic tasks and hundreds of other things. If you can do it yourself, you can probably get Keyboard Maestro to do it for you.
In this brief article, I’d like to share some of the macros I use most often.
I use these macros on both of my primary Macs (Keyboard Maestro can sync its settings and macros via Dropbox, and a number of other file-synchronisation utilities). You can also enable or disable groups of macros on a per-machine basis, so I have sets of “iMac only” and “Air only” macros too.
I have many more macros than those mentioned here, but these are the most generally-useful ones I’ve created. You can download each individual set of macros below. You can also host these macros elsewhere, if you wish, as long as you provide attribution and link to this page.
Most of these macros have keyboard-shortcuts as triggers, but you can easily change that to whatever sort of trigger you like: a floating palette, a menu item in Keyboard Maestro’s status-bar menu, when an app is launched, when you log in or connect a specific device, or many other possibilities.
Safari
These four macros act on the URL of the frontmost tab/window in Safari. They look for the last numeric parameter in the URL, and either increase it or decrease it, then reload the page. There are macros to increase or decrease by either 1 or 10. They have keyboard shortcuts set up by default.
These are very handy for viewing online galleries, multi-page articles, indexes and so forth.
Additionally, I’ve created a Headings macro, which shows a floating window with a list of all the headings (H1 to H6 tags) in the current Safari page. You can show the floating window by pressing ⌃⌥H by default.
Headings with id
attributes will be clickable in the floating window, and will take you to that heading on the page in Safari. If a heading doesn’t have an id
but does contain a link (i.e. <a href='…'>
), that link will be used instead. You can also trigger the first ten links using the access keys 1-9 and 0.
(The macro is technically two macros, since it includes a required companion macro that you won’t need to interact with directly.)
Note: These macros require Keyboard Maestro version 7 or later.
Google Chrome
These macros are a Chrome version of the Safari Headings List macros, described above.
Note: These macros require Keyboard Maestro version 7 or later.
This macro lets you type hisender
(“hi sender”) when replying to an email, and it will be expanded into a basic greeting, using the sender’s first name.
Hi [Firstname],
Thanks for your message.
The insertion point will be placed immediately after the last inserted sentence. You can tweak it to suit your needs.
Finder
This macro is actually by Andrew Burgess, with minor tweaks by me. It works on the selected file in the Finder, moving it to your Dropbox’s public folder and putting a sharing link on your clipboard.
You’ll have to tweak an URL in the script to reflect your own unique Dropbox public ID, which you can find via the Dropbox web interface. You’ll also need to tweak the script to point to your Dropbox folder, if it’s not in the default location.
App-Specific Notes
This pair of macros lets you enter a quick note to yourself that’s specific to the current (frontmost) app on your Mac. When you next launch that app, you’ll automatically see your notes. I find this really handy as a reminder of what I was doing, or what I should do next.
To edit the frontmost app’s notes, just press ⌃N.
You can press ⌥↩ to trigger the Save button in the notes window, and ⌥D to trigger the Delete button.
The notes are just plain text files. They live in the
AppSpecificNotes
folder, within Keyboard Maestro’sApplication Support
folder in~/Library
.
Note: These macros require Keyboard Maestro version 7 or later.
Heads-Up Info Display
This macro gives you a quick pop-up display of the current month’s calendar, the time, date, and (if you’re using a laptop) the current status of your Mac’s battery, including estimated time remaining. By default, the macro is triggered by pressing ⌃⌥-.
To install and use the macro, follow the instructions in the “HOW TO USE” file included in the download. You’ll need to set some things up first; it’ll only take a moment.
Keyboard Maestro Read 1 Record
Note: These macros require Keyboard Maestro version 7 or later.
File Icon macro
This macro shows you how to use the icons of files (or folders, or apps) in Custom HTML Prompt windows. By default, the macro is triggered by pressing ⌃⌥T.
To install and use the macro, follow the instructions in the “HOW TO USE” file included in the download. You’ll need to set some things up first; it’ll only take a moment.
Note: These macros require Keyboard Maestro version 7 or later.
Global
There are a few different macros here:
Centre mouse on the main screen. Does just what it says, and briefly highlights the cursor.
Dismiss Notification. This one moves the mouse to the ‘Close’ button of the topmost (most recent) on-screen Notification Center notification, and clicks the button. Technically, it double-clicks the button, which ensures the notification is dismissed (single-clicking was unreliable).
Front window to image on Desktop. This takes a screenshot of the frontmost window, asks you for the filename, and saves it as a PNG on your Desktop.
Right-click in frontmost window. I don’t like using the mouse, but some commands only exist in contextual menus. This macro pops up a contextual menu in the middle of the frontmost window. You could tweak it to do so under the cursor instead, if you like.
Type clipboard. A trivial macro that types out the contents of the clipboard, one character at a time. Useful for apps or sites that inexplicably and stupidly disable the Paste function in password fields and such.
Keyboard Maestro Free Trial
That’s all for now, but I’ll be sharing more macros in future.
Keyboard Maestro App
I highly recommend Keyboard Maestro to you; it’s been a godsend here. The more time I spend with my hands on the keyboard instead of the mouse, the more productive I am.
You can follow me on Twitter to keep up to date with articles like this.
My writing is supported by readers like you. Any contribution helps enormously.