Way of the future
TextExpander lets you assign blocks of text (or even images) to a shortcut you assign. For example, when I type
;nc it expands out to all my ncurses boilerplate.
;sig expands to my name, address, email, EARLs and phone numbers. You could leave it at that, and be crazy productive.
But you don’t have to stop there. If you create a new shortcut and choose choose “Context: Shell Script” from the top of the editing box, you can write shell scripts to process stuff. I ignored it initially, largely for the same reason I eschew (gesundheit) most Western fast food. I can eat it, but I prefer other things.
Earning some Siracusa cred
On a hunch this morning, I decided to test the limits of this “Context: Shell Script” box and enter some Perl (which of course I inserted with its own TextExpander shortcut!):
#!/usr/local/bin/perl […] print("Hello, world");
When I typed my
;test shortcut, Hello, world was inserted in it’s place.
Oh. My. SCIENCE.
That’s right, TextExpander took the output from this Perl script, and used it in the substitution. Think of the possibilities. No, seriously, think of them.
I’ve used Perl scripts, a Dock shortcut and the Mac pasteboard to automate and send results to where I want since 2004. Now I’m going to go through them all and see how I can make TextExpander shortcuts for all of them.