January 20, 2017 at 10:51 PM by Dr. Drang
I see four main reasons to automate a computer-related task:
- Speed. This is the obvious one that everyone thinks of. We’ll come back to it later.
- Consistency and accuracy. Little errors often creep in when you do a repetitive task by hand.
- Conservation of concentration. Multistep tasks can take your mind off of what you’re working on. I owe this insight to John D. Cook.
- Entertainment and satisfaction. Puzzling out an automation script is way more fun than Sudoku.
Last week, I created a one-off Keyboard Maestro macro in which Reason 2 overwhelmed Reason 1. So much so that the macro actually ran slower, on average, than doing the steps by hand.
I had volunteered to create a booklet for a school committee. All the pages were built as separate files in OmniGraffle, and the final steps to get the booklet ready for printing was to export all the individual pages as PDFs and then concatenate them into a single PDF to send to a local print shop. To have the printed book turn out as 8½×11 pages with printing bled out to the edges, each page was laid at 9×12 with crop marks near the corners. After I sent the file to the printer, though, she asked if I could regenerate the file without the crop marks—her software created its own crop marks and having two sets created interference.
Luckily, I had put my crop marks in a separate layer for each of the pages, so all I had to do was open up each page in OmniGraffle, make the crop mark layer invisible, and export as a PDF. With 28 pages in the booklet, this seemed like a natural for Keyboard Maestro, especially since exporting in OmniGraffle usually involves three button clicks all on its own.
But there was another wrinkle that I knew would come up. During the process of exporting, the Export sheet renders a small version of the to-be-exported items in the right half of the sheet.
For complex pages with many items, this rendering can take a few seconds. If my macro tried to finish the export before the rendering was complete, it would fail. So I put in a pause long enough to handle, I hoped, the most complex page.
In fact, pauses were needed at every stage of the export process to allow sheets and their controls to appear. This included the “There’s already a file named Page05. Are you sure you want to replace it?” sheet. The macro ended up with almost as many pause actions as action actions.
Using the macro was a three-step process:
- Open the OmniGraffle file for a page.
- Execute the macro by typing ⌃⌥⌘C.
- Sit on my hands to make sure they don’t jump to the keyboard to try to execute the steps themselves.
Every time I ran this macro, I felt certain I could’ve performed the steps faster myself. And for most of the files, I probably could have. But with 28 pages to export, I certainly would have messed up the steps at least a half-dozen times, leading to incorrect PDFs and the need to check every page carefully to make sure the right thing was exported. This was definitely a situation where the tortoise beats the hare.
One last thing. You may be wondering why I didn’t use Keyboard Maestro’s Pause Until action, which halts the macro until some condition—like a button becoming enabled—is met.
In theory, Pause Until actions would have allowed the script to run as fast as OmniGraffle would allow it to. The thing is, when I first started using Keyboard Maestro a few years ago I tried the Pause Until action in a couple of macros and found it unreliable. The macros would succeed or fail seemingly at random until I replaced the Pause Until step with a timed Pause. So I simply gave up on Pause Until and haven’t used it since. Again, the tortoise beating the hare.
I should give Pause Until another try, though, and see if Peter Lewis at Stairways Software has it working consistently now. While accuracy has to take top priority, I wouldn’t object to a little more speed.