Adding (+1) to US tel numbers in Address Book (Mac OS X)

This is my memo to share with everyone.

I moved to Japan, and needed to add +1 to all my US contacts. Then I found the following post

Adding 1 to all phone numbers in address book

However, I already have many Japanese phone numbers in my address book starting with “0” So I’ve modified Andreas’ code to the folliowing

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

So that it will skip the phone number starting with zero (0).

How to use the code

  • Launch AppleScript Editor
  • Copy and paste the above codes
  • Click [Compile]
  • Run the script (CAUTION)

If you have more than 300 contacts, you need the following extra step. Otherwise, the script may freeze (like it did it on me)

  • After clicking [Compile]
  • Save it onto [Library] – [Scripts] – [Address Book Scripts]
  • Go to Preferences of AppleScript Editor
  • In General, make sure “Show Script menu in menu bar” is checked
  • You will see “S” like curve on the menu bar on top
  • Launch Address Book
  • Go to script menu – AddressBook Scripts – [your script]
  • Then it will run without any notification
  • I had 1500 contacts, and it took me about 5 min


I had to include the script in the menu.

If I run the script in Script Editor, it always freezes at 380 items.

Other useful post

Need to add area code to all local contacts’ phone numbers