Posted on 2015-08-23
Last updated 2015-09-20
Changing your email or phone number isn't fun. You have to tell everyone, update all of your online accounts, and make sure your TextExpanders are up-to-date with the right information. One of the places I will always update is my contact information in Contacts.app, so why not just use that as the source of truth for TextExpander snippets?
getMyInfo function is fairly generalized to allow you to get any basic information like emails or phone numbers from your contacts. The first argument is the type1, and the second is the label you want, such as Home, Work, etc. To get a phone number, just change the function called to
getMyInfo('phones', 'iPhone). To get an address, change to
getMyInfo('addresses', 'home'), which will return a formatted address.
Update 2015-08-23: Updated the
getMyInfo function to support addresses.
Update 2015-09-20: For a while, I couldn't figure out why occasionally expanding things from Contacts would take a little while. Then I realized, for AppleScript to work, the application you're calling needs to be open. If you do want to use this as a way to expand your information from Contacts, just know that you'll need to be running the application for the TextExpander snippets to work.
Update 2015-09-20: I've figured out a way to do this without Contacts.app running! Check out my post here for more info.
You can find all the attributes in the Contacts.app scripts library in Address Book Script Suite → Application → myCard ↩