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") or perhaps a password generator script?

Leave a Comment

You can use the Markdown for links, strong, and emphasis tags in your comment.

From Oct 20th, 2007.

This article is tagged with TextExpander, software, OS X, Applescript, and howtos.

Commenting is currently enabled. There are 0 comments so far.

Related Articles.

On Charles Arthur's P2P moral dilemma.

has_web_fallback

Mass attribute assignment in Rails.

Pollock: a gem to help with html wireframing

Rebinding Spaces in Leopard.