Automation Fun

I really enjoy writing in Markdown. The plaintext syntax allows me to write quickly without worrying how things look. Its wonderful. A side-effect of writing in a plain text format is the relative ease by which I can add automation to my writing workflow. Repetitive tasks can be invoked with a tap or key-stroke, saving me time. Since I don’t need to worry about visual formatting, inserting snippets is even easier.

Automation is, essentially, a way to allow a computer to run through a series of tasks automatically whenever a trigger is established. These automatic tasks can be system-wide, or keyed to a specific application. Whatever the context, automation’s goal is to simplify repetitive tasks which reside in a user’s workflow. For my current needs, handling text is one particular task which fits the automation idea.

Despite the need, I wasn’t an early adopter of automated tasks on my computer. In fact, I was slow to adopt automation in my various workflows. I’m fast enough on a computer that I’d never felt the need to set up my own automatic scripts. In a similar vein, I’ve worked some with text-expanding apps but I’ve never felt they saved me all that much time. When I purchased the excellent Editorial editor for my iPad, however, this all changed. Editorial is built from the ground-up to be customized with various automation workflows. With few hiccups, I was able to set up workflows which created custom previews, generated templates, and inserted image tags 1. I became hooked. In fact, I was so hooked that when I ended up writing on my Mac I was annoyed at the loss of my workflows. So I went about making analogs on the Mac platform.

Apple's Automator workspace
The Automation Workspace in OS X.

Thankfully, Apple has two fantastic pieces of software built into OS X which makes this creating these workflows relatively easy [^though]. The first is AppleScript, a scripting language Apple has baked into the OS. The second is automator, which can be set up to do all sorts of actions in the OS and then set up to be accessed in a variety of ways – including as applications, system services, or folder actions.

For my latest automation workflow, I set up an AppleScript which follows several steps. First it opens a display dialog with a question prompt which asks me to give a description which I want to set for a particular tag. dialog asking for an image descriptionIt then takes this description and merges it with the rest of the text needed to create an image tag for my manuscript. Finally it sends the text of this tag to the clipboard, sets my favorite Markdown editor 2 as the active application, and pastes the tag in at the insertion point. I love it. Best of all, using Automator, I’ve set this script up as a system service which can be invoked with a keyboard shortcut. This saves me time, spares inevitable typos, and is just plain cool. Automation is well worth the time it takes to learn.

  1. In my sermon manuscripts I use an image tag with looks like **[image: \<description\>]**. I use these when I create my presentations. 
  2. Currently, it’s Typed