the candler blog

TextExpander Adds AppleScript Vocabulary, But Why?


Here was a nice surprise in my inbox this morning. The latest version of TextExpander (v4.0.3) released today, has the following tidbit in its changelog:1

Adds “expand” command to AppleScript vocabulary, allowing scripts to trigger expansion of a snippet

Now that’s a neat trick, and it works, but I can’t think of a single use for it. Yet.

TextExpander can already expand AppleScripts and Shell scripts, and it even allows you to nest snippets inside of snippets, a trick I take advantage of when composing link posts on this site. That’s already a few layers deep of nerd hackery. How can adding a snippet to an AppleScript, which already allows you manipulate and expand text and code, be of use? Anyone?

Anyhow, AppleScript wizard Justin Lancy was kind enough to get the ball rolling with the following script, sent my way by tweet. It’ll expand TextExpander’s stock “time” snippet.

timeexpand.applescript Gist
tell application "TextExpander"
	set my_Snip to snippet "ttime" in group "TextExpander Snippets"
	expand snippet my_Snip
end tell

Oh, the possibilities.

  1. I can’t find it online.