TextExpander and Applescript
SmileOnMyMac have released TextExpander 2.0 with some rather cool updates including
- Autoloading snippets from a url
- Selectively enabling snippets per application
- Scripted snippets.
It’s the last one that’s got me really interested. TextExpander can now use the output of an Applescript as a snippet. Which means I can drag out an update to my post about nesting snippets.
In the original post I looked at building an email signature from sub-snippets for your email, url and telephone number. Now we can tie the sub-snippets into Address Book.app to ensure we have the most up-to-date information.
set myName to "Gavin Montague" --change to your name
set theGroup to "phone" --change to "phone", "email", "address"
set theLabel to "home page" --change to item label "home", "work", etc.
tell application "Address Book"
set myItems to run script (theGroup & " of first person whose name =\"" & myName & "\"")
value of first item of myItems whose label is theLabel
end tell
You can download some scripts if you want a sample set.
The technique can also be extended to pull in other peoples details too. My girlfriend’s mobile is now jaemobile; my office address is workaddress and it doesn’t matter if either one changes because I generally remember to keep Address Book up to date.
That’s pretty cool but it’s just the tip of the iceberg. Maybe an email footer that includes the number of unread emails you have (“Gavin has 100 unread messages, don’t reply unless you really need to”); perhaps a password generator script? What dynamic snippets would be useful to you?