Dr. Drang posted this week about the value of throwaway macros and snippets. He’s a fan. So am I. I’ve referred to this before on the Mac Power Users but never posted on it here. Whenever I find myself doing anything remotely repetitive, my nerd-senses kick in and I look for automation. With text, that’s usually done in TextExpander. For example, a few weeks ago I had to ask a series of repeated questions that involved a rotating set of variables.
- Where’d you get the ACME dynamite on Contract #X?
- Did you leave the dynamite in Y’s expected path?
- Was it the same dynamite from Contract X?
- Did Y run over it?
- Did Y blow up?
My questions were actually a little different but I needed to ask them many times with various combinations of Xs and Ys.
In this case, the contract numbers were a 25 character string of gibberish and I already had a text file with all of the contract numbers in it. So I made the snippet with TextExpander’s clipboard function for the X. (Did you know TextExpander will insert the clipboard contents in a snippet? The syntax is %clipboard.) Before starting the snippet, I’d go to the text file and copy the contract number into my clipboard for my X.
For they Y variable I used a fill-in snippet. Don’t forget that you can have the same fill-in snippet repeat multiple times in a single TextExpander snippet. To do so, simply copy and paste the snippet syntax (e.g. %filltext:name=Sample Fill In%) in the snippet wherever you want it to appear. Then, when you trigger the fill-in snippet typing it once in the first instance fills it in at all of its other instances. Building the snippet took some time but once it was right, populating the questions (there ended up being hundreds of iterations) was fast and there were no mistakes. Overall, it took a fraction of the amount of time I’d have spent doing it manually and was much more accurate. Afterwards, the snippet was completely useless and went into the TextExpander dust heap but for a little while, it was my moon and my stars.
Speaking of TextExpander, did you know I have a whole page of downloadable snippets?