I was very pleased to be a guest on Mac Power Users Episode #181. We had a great conversation about all things automation on the Mac, but Katie and David both seemed to like one Keyboard Maestro macro in particular.
If you are impatient, you can jump over to the Github page for these two macros where you can download the macros. If you want to learn more about how it works (and the new 'trick' I learned in Keyboard Maestro), read on.
Building the macros
Most Keyboard Maestro macros fall into one of two categories: "global" macros, which should work anywhere, and "local" macros, which are only meant to work in a specific app (or group of apps). For example, most people are familiar with the keyboard shortcut ⌘ + space to start a Spotlight search. That keyboard combination should work in any application. That's what I mean when I say "global" –- it works at any time, in any application. Contrast that with something like ⌘ + Y which may or may not do something, depending on which app you are in, and it will most likely do something different in different applications. That would be an example of a "local" macro.
To limit these to just Safari, the macros need to be placed in a Keyboard Maestro "Group" which has been limited to just be active in Safari. Don't get overwhelmed! I'm telling you this detail to help you understand how it works, but if you use my macros you won't have to worry about creating this Keyboard Maestro Group, it will be done for you. But it's important to understand how it works and why it is important.
It's really not as complicated as it sounds; hopefully, this screenshot will help:
A larger version of this screenshot is available on Github.
In the left column, you can see a group called "Safari Only" Macros has been created. This group is like a folder which can hold any number of macros. In the second column you can see that I have 4 macros in that group (the 2 mentioned here and 2 others which are unrelated). In the right-most part of the window you can see that the "Safari Only" Macros have been set as only available in Safari. (If you wanted to rename the Group to something other than "Safari Only" Macros you would do that here.)
When you import the macros I have created, Keyboard Maestro automatically creates the "Safari Only" Macros group, and it knows that these macros are only to be used in Safari. I mention it here only as explanation; you should not need to do anything in Keyboard Maestro to get them into this group.
Once you have imported the macros into Keyboard Maestro (either by double-clicking on the .kmmacros file or by choosing File » Import... in Keyboard Maestro) you can look through the macros to see how they were put together. Do not be overwhelmed! These macros may look complicated, but that's mostly because I was very thorough, and added a lot of error-checking that I will admit I don't always include.
What these macros do is really quite simple. Look at this menu item, and notice that in one there is a checkmark, and the other there isn't:
Maybe you're thinking, "But isn't a keyboard shortcut easier?" Well, maybe, but at its core, the macro to toggle this setting simply chooses that menu item, then it looks to see if the "Reload Page" item (under Safari's "View" menu) is enabled. If it is (meaning Safari has already loaded a page), it reloads the page, otherwise it stops. Now, already I have improved upon a keyboard shortcut, because I'm getting two actions for one keyboard shortcut.
With a few minutes of extra work, the macro can be easily expanded, and the benefit of those extra minutes will benefit me every time I use this macro in the future. So here are the extra features I added into the macro:
What problem did we solve, and how much effort did it take?
Creating this macro probably took me about 10 minutes, but I will benefit from it every single day that I use Safari, on every Mac that I own, into the foreseeable future. Every time I press ⌥ + J or ⌘ + J, I'm going to be just slightly happier than I would have been without it, and I'm going to be slightly happier just after a moment of frustration ("Why is this site doing that?! Well, I can fix this easily enough.")
This is the one of the benefits of doing these bits of automation on your Mac: it may not change the world, but it makes your part of it a little better and more enjoyable. What may be the best part of this particular effort, for me, is knowing that Katie Floyd and David Sparks are probably going to be using this too, as well as some listeners to the Mac Power Users podcast, and some people reading this article. So I've made their part of the world just a little better too.
Subscribe to Newsletter
Software Updatesmore updates
- Dropbox adds file/folder renaming and Office document editing to iOS app
- Vizzywig 8xHD price tag now a very affordable $49.99
- Automatic targets teen drivers with License+ service
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)