Creative Text Expanding

Today's Best Tech Deals

Picked by PCWorld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

Another utility in my essential arsenal is TextExpander. As a long time TypeIt4Me fan, I've always had something installed to reduce repetitive typing (as well as correct the occasional typo). It's a huge time saver for anyone who writes a lot.

I've also taken recently to using it for more non-traditional text replacements. For example, I use it for some HTML templates. That's not hugely clever, except I integrate both the ability to insert the clipboard contents and the cursor positioner to take an img tag, insert the clipboard contents as the src attribute (the URL of the image), and then position the cursor in the alt attribute (the field for describing the picture). I also threw in some Web site specific styling. With a quick expansion like that, I copy the URL of the new image, type my abbreviation (in my case bimage for blog image), and type what it is.

<img class="right" src="%clipboard" alt="%|" />

More recently, TextExpander added the ability to run shell scripts. As a regular Terminal dweller, this can be a big time saver, particularly when you're too lazy to visit Terminal (as I am). I frequently like to check what processes are running with a particular string in their name. For example, if you need to find out what the process ID for the Dock is, you'd want to use:

#!/bin/bash ps -cax | grep `pbpaste`

Make sure you copy the text "Dock" to the clipboard before you begin. Another quick thing is to check the number of words or characters in the text you just copied to the clipboard. For this, you'd use:

#!/bin/bash pbpaste | wc -w

Use the argument -w for words and -c for characters.

Does anyone else have a clever use for TextExpander?

This story, "Creative Text Expanding" was originally published by Macworld.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon