Dipping my toes into Keyboard Maestro

I know Gabe will laugh at me because of this, but I’ve finally succumbed to the temptations of Keyboard Maestro.

It’s not that I didn’t understand its appeal before, but as I’ve gotten older I’ve gotten more particular about which tools I invest my time in learning. I want them to have a depth that rewards that investment. While Keyboard Maestro isn’t as deep as a programming language, it comes pretty close, a fact I’ve come to learn largely through Gabe’s many posts.

I’m starting out simple. I wanted a set of keyboard shortcuts that would switch between Sort by Name and Sort by Date in both the Finder and Transmit. I use Transmit in a way that may seem odd to most people. Instead of the traditional double-pane view with the remote server in the left pane and my local disk in the right, I use it in single-pane mode, showing only the remote server. I drag files to and from it as if it were a Finder window.

Normally, I have my Finder and Transmit windows configured for List view with the files sorted by Date Modified. Sometimes, though, it’s easier to work with the files sorted by Name, so keyboard combinations that switch between the two—and work the same in both apps—would make my life a lot easier.

Here’s the macro for sorting by date in the Finder, which I have bound to ⌃⌥⌘D:

Sort by Date in the Finder

And here’s the corresponding macro for Transmit, with the same binding:

Sort by Date in Transmit

Simulating a mouse click for the Finder macro is a little dicy. If I hide the sidebar or change significantly the width of the name field (which is the only field I have to the left of the date field), that click will go in the wrong spot and the macro won’t work. There’s an Arrange by▸Date Modified command in the View menu, but I don’t like the way it breaks up the list into sections. An advantage of simulating a click is that I can toggle between ascending and descending sort by pressing ⌃⌥⌘D repeatedly.

The Transmit macro is more robust to changes in window geometry because its column headings are recognized as buttons and can be addressed as such.

Update 12/5/13
A few people on Twitter have suggested using the Option version of the Finder’s View▸Sort by▸Date Modified command (or the keyboard equivalent, ⌃⌥⌘5). This is a robust solution, in that it works no matter how I have my Finder window configured, but it doesn’t allow the ascending/descending toggle. Given that the Transmit version of the macro does toggle and that I want the two macros to work the same, I think I’ll stick with the simulated click for the Finder.

But I thank Frederik, Alex, and Ben for letting me know that the Option key brings back the old, unsegmented Sort by behavior. I probably should’ve guessed that, but I didn’t.

As I think about it, I could probably write an AppleScript that would be robust and toggle the sort. It probably wouldn’t be as fast, especially if AppleScript isn’t already in memory, but it’s worth looking into.

I have similar macros for Sort by Name, each bound to ⌃⌥⌘N. I’m sure you can guess what they look like: the Finder macro clicks at an X value of 200 instead of 500, and the Transmit macro presses the Name button.

Don’t worry, I won’t typically waste your time with posts on macros this simple. I know most of you are way ahead of me.


Comments are closed.