Skip to content

Keyboard Maestro

Create a pop-up web search tool using Keyboard Maestro

My original Keyboard Maestro special character palette (which has been replaced by a much better version), used the Conflict Palette to display a window from which you could pick the special characters.

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.

Feel free to download my macro if you'd like to use/modify it.

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.

[continue reading…]



A much-improved special character palette

A while back, I created a pop-up character palette using Keyboard Maestro to allow easy insertion of the Mac's special characters (like , ⌘, ⌥, etc.). While this worked fine, I discovered a few major shortcomings:

  • I couldn't create more than one character without calling up the palette again.
  • I had to decide in advance if I wanted HTML entities or the actual characters.
  • Two palettes (HTML or character) meant two keyboard shortcuts to remember.
  • Adding characters to the palette was a real pain, because they had to be done twice.
  • I was out of digits for shortcuts, so I was going to have to change the palette structure.
  • It was slow: From calling up the palette to identifying which icon I wanted to use to selecting that icon, and then doing it all again for a second character was just really slow.

I set out to fix all of these issues, thinking I could use Keyboard Maestro's Custom HTML Prompt action, as I did for my iTunes song info window. And, in the end, that's what I used for the new-and-improved character palette:

This doesn't have to be used just for Mac special characters, of course. You could make yourself a customized pop-up for emoji, math symbols, whatever…

Read on for the how-to and download, if you'd like to put this to use…

[continue reading…]



Automatically prevent Messages’ URL Previews

I spend a lot of time in Messages in macOS, and one of its newer features is something called link previews, as seen at the right side of this text block.

While these previews can occasionally be useful, most of the time, they're just annoying: I'm talking with people I know, and we trust the links we send each other, so the preview is superfluous. Plus it makes it nearly impossible to rickroll anyone. But what's really annoying is that they make it impossible to send messages like this:

Oh, have you seen [paste copied URL]http://www.istocknow.com?

Try that, and the URL becomes a preview, and the question mark vanishes. It really interrupts conversational flow. You can prevent this by either writing text on both sides of the pasted URL, or surrounding the URL with angle brackets:

Oh, have you seen <[paste copied URL]http://www.istocknow.com>?

So there's the quick tip: To prevent link previews, surround your pasted links with either text on both sides, or more simply, angle brackets.

A cleaner solution: Use a dot at the front and end of the URL. Messages will make the dots vanish (if the URL is on its own line, otherwise it leaves the leading dot), and yet not preview the message. Thanks to reader Christopher for this tip—using it, URLs pasted on their own line are just clean URLs, no previews, no brackets. I updated my macro, changing the brackets to dots in the relevant steps. I haven't edited the version you see here, though.

But because I often forget to do that, I wanted it to be automatic. Thanks to Keyboard Maestro, I was able to make that happen: When I paste a link in Messages—using the system's standard ⌘V shortcut—it's enclosed in angle brackets. If I paste anything other than a URL, it's pasted as is. If I do want a preview, I can use the actual Paste menu item instead to get a link with preview.

This solution is perfect for my needs, as I always use ⌘V to paste, and I so rarely want to send a link preview that it's OK that it requires a trip to the menu. (If it ever does annoy me, I'll just remap Paste in Messages to ⌃⌘V or somesuch.

[continue reading…]



Capture a series of screenshots and create a movie

At my day job with Many Tricks, we recently updated our time tracking app Time Sink to version two, and an updated web page was part of the project. For the header area, I wanted to create a time-lapse movie showing the Time Sink Activity Report window changing over an extended period of time (90 minutes), but compressed into a short amount of real-world time (about 14 seconds).

Before the how-to, here's how the final project came out:

To create the time-lapse movie, I'd need a series of screenshots recorded at a fixed interval. I wanted to shoot only the content area of the report window, as I didn't need the "chrome" for the movie (it would just distract from the content). So using the built-in screenshot tool wouldn't work—I didn't want to have to crop 500+ images (even by script).

While I'm sure there are many utilities that can do this (and I'll see them shortly in the comments), a brief web search found nothing that was designed to capture areas of the screen at a set interval. Luckily for me, though, Keyboard Maestro has a screenshot action that can record an area of the screen, along with repeat and wait actions I could use to capture a series of stills.

[continue reading…]



Easily insert special Mac characters using Keyboard Maestro

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 &#xF8FF;. 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.

As always, you can download these macros if you'd like to use/modify them for yourself.

[continue reading…]



An even easier way to use Excel’s Paste Special dialog

I recently explained how to use the keyboard in Excel's Paste Special dialog box, and this is a great timesaver on its own. But I use Paste Special a lot, especially with Formats, Formulas, and Values, so I made those three even easier to use via the keyboard…

Each one has its own direct keyboard shortcut, courtesy of Keyboard Maestro. Here's how I set it up; these instructions should work (with some changes, of course) for any app that can script keystrokes.

First, I created these macros in an Excel group, so they're only active when Excel is frontmost (no need to create global hot keys that you only use in one program). The actual macros are pretty trivial:

  1. Send Command-Control-V to bring up the Paste Special dialog
  2. Pause just long enough for the dialog to appear onscreen
  3. Send the chosen shortcut key—T, F, or V in my vase
  4. Send the Return key to execute the action

Then I just assigned each one to the same key used within the dialog, but with Command and Option to make it usable from anywhere within Excel.

[continue reading…]



Put Unix path to selected Finder item on clipboard

Thanks to the commenters for pointing out the much easier way to do this: Select an item in Finder, then press Command-Option-C. All done. Leaving the hint here as an example of a Rube Goldberg machine.

In two recent geeky tips, I showed how you can open a Terminal window in the directory of the selected Finder item, and how you can view Unix man pages in Preview. To finish the trifecta of geekiness, today's tip lets you quickly place the Unix-style path to the selected Finder item on the clipboard. (It's actually a simplified version of the 'open this in Terminal' tip.)

The AppleScript that accomplishes this is quite simple:

If you run that in Script Editor, you'll see that your clipboard contains the path to whatever you had selected in Finder. But running the AppleScript in ScriptEditor isn't a great timesaver. Instead, put it into whatever tool you have that can run AppleScripts via hot key or menu bar entry or whatever.

In my case, I put it into a super-simple Keyboard Maestro macro. I've set it up to show in the Keyboard Maestro menu bar when Finder is active:

There are countless tools that can run AppleScripts in various ways, including our own Butler, LaunchBar if you save the script first, etc.



View Unix man (help) pages in Preview

Today's tip goes well with yesterday's tip, which explained how to open any Finder item's folder in Terminal via Keyboard Maestro. Once in Terminal (and sometimes even when not in Terminal), I'll often want to check out the man page (help) for a given command.

You can do this directly in Terminal with man [name of command], of course, but then it opens on top of whatever you were working on, and you have to read it in Terminal. You could use another tab or window, but you'd still be reading in Terminal. There are times, too, when I'm writing about the Unix side of macOS, so I'm not even in Terminal, but still want to view a man page.

My solution to this problem is two different ways of doing the same thing: I open man pages as nicely-formatted PDFs in Preview. The method I use to get to that point depends on if I'm working in Terminal or not.

Update: I've modified the script and macro so that they properly handles two-argument man commands, such as man 3 printf.

In Terminal

Based on an old Mac OS X Hints tip, I created a very simple shell script:

The key to this little script is the -t option on the man command. From the (hehe) man man help file, here's what that does:

  -t     Use /usr/bin/groff -Tps -mandoc -c to format the manual page,
         passing the  output to stdout. The default  output format  of
         /usr/bin/groff -Tps -mandoc -c is  Postscript, refer  to  the
         manual  page  of /usr/bin/groff -Tps -mandoc -c for  ways  to 
         pick an alternate format.

In other words, the -t converts the help page into a PostScript file, which is something that Preview can easily open (which is just what the last line of the script does).

I named this script preman, because it uses Preview to open man pages. Once saved, I made it executable (chmod 755 preman), and I can then open any man page in Preview by typing, for instance, preman bash.

The output is nicely formatted, and by opening the man page in Preview, my Terminal session is uninterrupted. A quick adjustment with Moom, where I have a saved layout to position Preview and Terminal, and I can scan the man page while working in Terminal.

But what about when I'm not in Terminal? For that, I basically implement the same shell script, but with it set up to run within a Keyboard Maestro macro.

[continue reading…]



Open Terminal in selected Finder folder

Today's tip is just a re-implementation of a really old Mac OS X Hints AppleScript that lets you open a Terminal window with the working directory set to (i.e. cd'd into) the selected Finder folder.

This makes it really easy to jump into Terminal to do something from Finder, without having to do any mousing and minimal typing. What's new is that I've used Keyboard Maestro to turn the AppleScript into a macro that runs only in Finder, where it's available via hot key or menu bar trigger.

Here's the complete macro; download it now to look at and/or use as you wish. [Note: If you use iTerm2 instead of Terminal, you'll want to download this version instead. My good friend James, who runs Out of Control, did so. He tells me it works great.]

The name of the macro may look a bit odd—the 03) controls the sort order in the Keyboard Maestro menu bar item, and does not display when the menu is activated:

Keyboard Maestro also helpfully displays the assigned keyboard shortcut in the menu bar item, in case I've forgotten it.

[continue reading…]