Skip to content

macros

Create a Time-Machine-like backup of Keyboard Maestro macros

I use Keyboard Maestro a lot—a quick search here reveals how often I write about it, and I use it much more than I write about it.

I back up my macros reliably, as part of my overall backup plan. I also sync them between my Macs. And a while back, that caused an issue: Between the regular backups (Time Machine and removable external drive), I had a sync issue and I lost a few hours' worth of work on a new macro, and some untold number of old macros vanished. I recovered the older macros, but the new work was just gone.

So I set out to find a better backup solution for my macros.

I wanted a tool that created something close to versioned backups that were browsable in Finder, that didn't take a ton of drive space, and that made it super-simple to restore any single macro or macro group*Time Machine backs up the entire macros file, not individual macros or groups from some point in history.

I also wanted it to be completely risk-free to use, never modifying my macros in any way (so no import tool in the macro). I wanted Keyboard Maestro Time Machine, basically. As I couldn't find an existing solution that worked in that manner, I wrote my own.

[continue reading…]



Search sites from anywhere via shortcuts, version two

Jan 14 2022: Version 2.5 is out, with a bug fix and a new check for updates button on the help panel. Download the macro, or get the update by manually running the Update check macro within the 2.4 release.

Jan 14 2022: Version 2.4 is out, with an optional "no text" input dialog, a default mode to search a favorite site without a shortcut, and faster processing of search terms.

Jan 9 2022: Version 2.3 is out, with a new download verification feature (which will be useful starting with the next update), a much simpler update checker, and some minor bug fixes.

Jan 4 2022: Version 2.2 is out, with a fix for an annoying bug I introduced in the update checking code that could cause the macro to quit after being invoked. Sorry!

Jan 2 2022: Version 2.1 is out. The most-obvious new feature is shown at right—a live-filter option for the list of shortcuts in help.

But there's lots more—check out the release notes to see the full list, including the newly-added shortcuts.

A week or so ago, I published the first version of Web Search via Shortcuts, my Keyboard Maestro macro that lets you, well, search the web from anywhere via shortcuts—you can type rob macros, for instance, to search this site for entries related to macros.

I was very happy with how the macro worked, but behind the scenes, it wasn't all that good. What started as a small project (make it easier for others to customize the list) turned into a near-total rewrite. So…introducing Web Search via Shortcuts, version 2.0:

If you need more general information on how the macro works, please refer to the original post; there's a lot there I'm not repeating here.
[continue reading…]



Search sites from anywhere via abbreviations

Note: This post is no longer updated. Please see the version 2.0 post for current details and download links. This post remains because it has a fair bit of information about the macro in general.

Nearly five years ago, I wrote about my simple Keyboard Maestro web search macro that let me search many web sites from anywhere within macOS. While it worked well, it felt a bit cumbersome—I had to scan a pop-up palette of sites, and then press the proper key to select the site I wanted to search (so I had to keep the list relatively short). Then I'd wait for a new prompt to appear, type the search terms, and press Return.

Because of my macro's convoluted interface, I found myself using our own Butler most of the time, as it offers an interface similar to SafariKeywordSearch (which works in Safari as an extension; I was reminded of it due to a recent post by @danmoren on Six Colors). Both it and Butler do keyword searches, so you can type d best home vacuums to search DuckDuckGo for best home vacuums, or gm Tokyo to search Google Maps for Tokyo.

I decided to rewrite my macro to work like those apps do, but with an added feature: I use a number of browsers, and there are times I want my search to run in something other than the default browser. Using my rewritten macro, I can now optionally specify a browser in which to run the search. So when I activate the macro, I can use one of two different formats for the search command:

Both of those searches will search the Apple Movie Store for movies with the keyword disaster; the one on the left will use my default browser (currently Safari); the one on the right will use Edge.
[continue reading…]



Simplify VPN connections via TunnelBlick

I use a VPN on our home router, which runs pfSense. When I'm on my laptop, I connect to the VPN for two reasons. The first is security when using unknown wifi connections. The second is for ease of access to my home Macs and network—when on the VPN, my laptop appears as part of the local network, so screen and file sharing are simple and 100% reliable.

To access the VPN, I use TunnelBlick, which runs as a menu bar application. Launch the app, activate its menu bar item, choose your VPN connection profile from the list, enter your password, and you're connected. But doing this several times a day gets annoying quite quickly. Thankfully, TunnelBlick includes AppleScript support.

Using that support and Keyboard Maestro, I wrote a few macros to simplify connecting to and disconnecting from our VPN, as well as changing the DNS address depending on whether I'm connected to the VPN or not.

Technically, the DNS address shouldn't have to be switched—I have the VPN and Tunnelblick configured to automatically switch on connect, but for whatever reason, it's just not happening. So I included DNS address switching in my macros.
[continue reading…]



Remove tracking data from copied URLs

A while back, my friend James and I were discussing the amount of tracking cruft in many URLs. In my case, I subscribe to a ton of email newsletters, and I noticed that those URLs are just laden with tracking information—and most go through a URL processor, so you don't really see those tracking details until you've clicked the link, at which point it's too late to avoid any tracking.

I wanted a way to clean up these URLs such that the least-possible tracking information was sent to a server—and in particular, to prevent any browser cookie creation. In addition, if I want to share a link with friends, I don't want to send them a crufty tracker-laden link—I wanted a nice clean shareable URL.

Note: I wrote all of this before I knew about Jeff Johnson's Link Unshortener, which does all of this (and more) in a "real" app. If you'd like the easy solution, Jeff's app is the way to go. Mine is definitely a do-it-yourself concoction that's not for the faint of heart.

tl;dr version: Install this macro group (v8.3) in Keyboard Maestro to remove tracking details from copied URLs in a set of defined apps.

Latest Update: Apr 11 2022 Fixed a bug related to custom domains, added aliexpress as a decrufting URL, and updated the in-app help boxes.

Going forward, all future updates to this macro will be found in this post on the Keyboard Maestro forums.

[continue reading…]



Archiving and version control for Keyboard Maestro

As much as I rely on our own Many Tricks' apps every day, there's one I rely on more: Keyboard Maestro (KM), the macro app for macOS that can do pretty much anything. How much do I rely on it? The shrunken image at right lists all of my macro groups—not macros, just the groups holding the macros. In terms of actual macros, there are over 425 at present. (These are not all user-facing; many are macros that support other macros.)

I use KM for everything from gathering monthly utility bills to inserting HTML code in blog posts to generating replacement license files for users to controlling iTunes to decrufting URLs when copying (future post coming on that one) to automatically naming and filing documents I scan to storing snippets for insertion into our apps' help files to opening oft-used URLs to adding key functionality to many apps such as Excel, Mail, Messages, Photos, Preview, Safari, etc. In short, it's the single most-used app on any of my Macs.

For as much as I love KM, it has one major shortcoming: All of those macros live in one large XML file. Yes, I back it up to many local and cloud locations, so I'm not worried about losing it. It does mean, though, that if I mangle a single macro while trying to fix something, there's no easy way to get back to the working version (assuming I've gone past the point of multiple undo steps).

But now I can recover from such stupidity, thanks to the amazing Macro Repository Suite from Dan Thomas. This suite consists of two macros: One that updates (and initially creates) the repository, and one that restores a given macro from the repository.

[continue reading…]



View charts for stocks in the mop Terminal app

Yesterday, I noticed that the Stocks Dashboard widget in Mojave was no longer working. I couldn't find a similar (small window, always there, only stock prices) app that did what I wanted, but I did discover mop, a Go program that runs in Terminal. Using mop and Terminal's ability to save a window layout, I was able to craft a solution that worked for me.

Then commenter smayer97 asked…

Any solution to replace the mini-graphs at the bottom of the old Dashboard widget?

I didn't pay much attention to the graphs in the widget, so I hadn't considered them in my solution. And there's no way I was going to find a tidy graphing solution that also worked in Terminal. What I came up with isn't quite as convenient as having the graphs available at all times, but it's pretty close—I just have to click on a ticker symbol while holding down some modifier keys:

As you might have guessed, this is powered by a Keyboard Maestro macro, and I love how well it works.

[continue reading…]



Updated: Find Keyboard Maestro macros by shortcut

Note: Revised on December 4, 2018 with a much better implementation of the pop-up palette, and some changes in timing and mouse movement.

One of the "problems" with Keyboard Maestro is that it's so useful I use it a lot, leading to a large collection of macros. Due to the number of macros, sometimes when I want to add a new shortcut, I can't remember if I've used that shortcut before or not. Today's tip comes in two flavors to address that problem: Simple and Complex.

The Simple solution

Short of just trying the shortcut, there's a way to check from within Keyboard Maestro itself: Type the macro's activation keys into the search box, as seen in the box at right.

You can't do this by pressing the actual shortcut keys—you have to type their character representations. You can do this with the "Show Emoji & Symbols" option under the flag icon in the menu bar, if you've enabled it in the Keyboard System Preferences panel. But finding those few special keys (if you even know how to search for them) is a pain.

Technically, you could also use the pop-up character palette macro I wrote, except there's an issue: When the palette activates, it deactivates the search box, so the characters don't make it there. It's also overkill for this task, because there are characters that wouldn't be part of keyboard shortcuts, and you'd never need the HTML codes, just the characters.

So I wrote what wound up being a set of new macros that make searching for assigned keyboard shortcuts much easier.

[continue reading…]



Easily delete albums in Photos

Last fall, I finally made the move from iPhoto to Photos…months later, I still find myself frustrated by many things in the Photos' user interface.

Today's aggravation dealt with cleaning up a bunch of older photo albums—some I just wanted to delete, others I wanted to convert from Smart Albums into normal albums (because I wouldn't be adding any more photos that used the keywords in the Smart Album). That meant I wanted to delete a bunch of albums—well over 100.

Deleting an album in Photos can only be done from either the My Albums overview, where you can select more than one (though not across folders), or via the contextual menu in the sidebar.

The My Albums view wasn't going to work for me, as I needed to look at and work with many of the albums, across many folders. But after the sixth time of doing the "right click, select Delete Album, tab to Delete in the confirmation dialog, press Return" dance, I was sick of it. Time for another Keyboard Maestro macro.

This one is very simple—it just replicates the actions required to delete an album. With it in place, I click on the album I wish to delete, then press Control-D. It's still more mouse interaction than I'd prefer—why can't I select albums via the keyboard?—but it's oh so much faster than using the contextual menu.

[continue reading…]



Count characters in Keyboard Maestro inputs via filters

Yesterday, I added an SSL certificate to my site, and posted a brief note about the change. In that post, I included an image…which turned out to be, well, the comments say it all:

Yes, I posted a non-https image in the 'site is secure' post. Sigh.

So I took Jonathan's comment to heart, and created a Keyboard Maestro macro that ensures I post only relative URLs from now on.

Generally, I don't think such a thing would be worth sharing, as it's just a basic text replacement macro, right?. Mostly right, but in this case, I learned about a Keyboard Maestro feature that may be useful to others. So share I will…

[continue reading…]