Internationalizing Your Contacts

Posted on 2013-07-07

Living in the U.S. we rarely call people outside of the country. Whenever we create new contacts in our address book, they'll typically start with the state's area code and omit the country code.

Since moving to Ireland, my contacts wouldn't show up correctly since I hadn't prepended all of contacts with '+1'. I wasn't about to manually change all 700 contacts in my phone and fortunately came across a nice post that had the following AppleScript:

tell application "Address Book"
    repeat with eachPerson in people
        repeat with eachNumber in phones of eachPerson
            set theNum to (get value of eachNumber)
            if (theNum does not start with "+" and theNum does not start with "1" and theNum does not start with "0") then
                set value of eachNumber to "+1" & theNum
            end if
        end repeat
    end repeat
end tell

Before running this, I highly recommend backing up your contacts. This can be run easily by just launching AppleScript Editor and pasting in the code above. Enjoy!

Tags: automation applescript


© Ryan M 2023. Built using Pelican.