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.
As my collection of macros has grown, and some of those macros have gotten more complex, I’ve been using a few of KM’s features to help keep my macros organized, and make it easier to debug them while I’m working on them. Some of these are obvious, some maybe not so obvious, so I thought I’d share what I’m doing.
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…
Today in The Mac Observer Melissa Holt wrote about using the TextEdit/ Edit/ Transformations command to change the case of a sentence or paragraph. However, there is no option to perform, “Sentence Case”, i.e., capitalize the first letter of the first word, and keep all other words in lower case.
Is there a way in Terminal, or maybe Keyboard Maestro to add this option to Transformations? It seems to me that the given choices have rather limited uses.
In addition to not offering sentence case, the Transformations menu has a few other drawbacks:
Not all apps have a Transformations menu.
Only three very basic transformations (upper, lower, capitalize) are supported.
The transformations are buried in a sub-menu, requiring lots of mouse navigation to reach.
While I don’t believe it’s possible to modify the Transformations menu, it’s pretty easy to use Keyboard Maestro to build a “Sentence Case” transformation…or more usefully, as seen at right, a palette with many more transformations. Unlike the Transformations menu, the Keyboard Maestro solution will work in any app where you can copy and paste text.
While this turned out to not be ideal for the special character palette (no way to pick more than one at a time), the Conflict Palette is ideal for many other tasks.
I use the one at right to search a number of web sites—activate the palette with ⌃⌥L then press a, for instance, type a query, press Return, and my browser loads with search results from my old macosxhints.com site.
I use a couple additional palettes—one for retrieving iTunes’ artwork and searching the store, and the other for inserting commonly-used bits of code while writing help files in Coda for the Many Tricks‘ apps.
Here’s how the web search palette looks in use; I love being able to search a specific site from anywhere without first switching to my browser. And because I have Keyboard Maestro syncing its macros, I can do this from any Mac I own.
The advantage of using the Conflict Palette for these web searches is that I need only remember one shortcut, not 11 different ones, and the palette is a nice visual reminder of which service I wanted to search.
Note: I’m leaving this up for historical purposes, but there’s a new special character palette in town, and the new one is vastly superior to this version. This hint might be useful for general Keyboard Maestro knowledge, but really, use the new version if you want a special character palette.
Between blog posts and documentation for Many Tricks, I find myself typing the Mac’s “special character” symbols quite often: ⌘ (Command), ⌃ (Control), ⌥ (Option), ⇧ (Shift), and (I think that’s an Apple).
You can type some of these via keyboard shortcuts (the is ⇧⌥K), or by using the Emoji & Symbols viewer. But I find both those methods clunky and slow; instead, I used Keyboard Maestro to create a couple of pop-up palettes that show all the characters:
I use two palettes because while I typically can paste the character itself, that doesn’t work in some spots—like here in the WordPress’ blog post editor, for instance. In those places, I need to use the HTML code for each character—so that cute little appears when I insert . Ugh. Hence the character palette on the left and the HTML palette on the right.
When I want to insert a special character, I first type the activation keys for either the character (ccc) or HTML (hhh) palettes. When the palette appears, pressing one through five will insert the corresponding character or HTML code for that character. No keyboard shortcuts to memorize, no need to negotiate the Emoji & Symbols viewer. Just a few keystrokes, aided by a visual representation of each character, and I’m done.
For those who aren’t aware, Keyboard Maestro is a macro-creation tool, designed to help you automate routine tasks. But its powers let you do some really cool stuff, not all of which could be classified as automation. Such is the case with this project: Creating an iTunes song info pop-up window.
There are lots of apps out there—including Many Tricks own Butler—that can do this for you, and my Keyboard Maestro version is worse than most of those in many respects. However, I wanted to teach myself more about Keyboard Maestro, and this seemed like a good project with which to do so.
I use Buter’s iTunes pop-up info window, which looks like this:
I wasn’t really interested in the rating or volume controls (though they should be doable), but I wanted to see if I could get the album art and song info in a window via Keyboard Maestro. After some struggles, here’s what I came up with in Keyboard Maestro:
My window is larger by design, so I can have somewhat more visible album art (aging eyes). And I can’t decide on a background color or gradient, so it keeps changing—this was the look when I snapped the screenshot, but it’s since changed again.
Read on if you’d like to know more about Keyboard Maestro, and how I used it to create this iTunes info window. (Note that this write-up assume some familiarity with Keyboard Maestro, though I try to explain each step in the process.)
The issue, of course, is the macOS ships with ⌘O (Open) and ⌘P (Print) as pre-assigned keyboard shortcuts in Finder. Select a bunch of files to open, reach for the O and miss by just a touch, and you’ve started a dozen print jobs. Whoops!
Years ago on macosxhints.com, there was one of those “duh!” tips with an easy solution to this (and other similar) issues: Reassign the stock keyboard shortcuts. Here’s a “fixed” Print shortcut in Finder, for example:
And with that simple change, no more accidental print jobs.
Changing the shortcuts is easy; start by opening System Preferences > Keyboard, then going to the Shortcuts tab. Scroll to the bottom of the left-hand pane, select App Shortcuts, then click the plus sign. You can then select an app—or all apps—from the first pop-up menu, enter the menu item to change/assign in the first input box, and type the shortcut to use in the third:
You can do this for as many of the stock shortcuts as you wish…and obviously, you can add some that you feel Apple left out. Read on to see what I change in the Shortcuts section—not just for applications, but in all of the sections (Launchpad & Dock, Mission Control, etc.)
Ever run into a program that has some pre-defined keyboard shortcuts you don’t like? In most cases, they’re associated with a menu item, which means you can use macOS’ built-in keyboard shortcuts function to fix them. (In System Preferences > Keyboard > Shortcuts > App Shortcuts.)
But what if the shortcut isn’t associated with any menu item? Such is the case in Excel 365, which replaced a couple easy-to-type shortcuts (⌃I and ⌃K for inserting and deleting rows and columns) with much harder to type versions: ⇧⌃= and ⌃-. If there’s no corresponding entry in the app’s menus, it seems impossible to remap the shortcuts—unless the app itself offers that feature, which Excel did in prior versions.
The good news is that it is possible to remap any keyboard shortcut in any app, as long as you’re willing to add one more program to the mix: Some sort of macro app. My example uses Keyboard Maestro, but any app that can send a key sequence in response to another key sequence will do the trick.
My recent tip about using Keyboard Maestro to toggle the visiblity of hidden items in Finder (which turned out to be irrelevant for Sierra users; just hold ⌘⌥.) works by checking a hidden macOS preferences setting. In this case, I checked for the existence of the AppleShowAllFiles key, which let me toggle the visiblity of invisible files based on the result of the check.
Controlling a macro—or a shell script or AppleScript—by checking (visible or hidden) preference values can be very useful. But how do you find out the name of the preference you need to check, and in which domain (preferences file) you’ll find it? Hidden prefs are actually easiiest, because the command you use to write them tells you both the preference name and its location. For the hidden files in Finder tip, for instance, the command is this:
So to check that in a script, I just need to save the results of defaults read com.apple.Finder AppleShowAllFiles into a variable, and I can then take action based on the variable’s value. But what about a normal pref, in an application (or in System Preferences)? Say you wanted to check whether Apple’s Pages app was set to show its rulers in inches or centimeters…
Why would you want to know this setting? I don’t know, I was just trying to come up with an example. Just go with it…
How do you find out the key name associated with that particular preference, and what file it’s stored in? I use a couple of different methods.