Adding 1 to all phone numbers in address …
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Does anyone know how to add 1 infront of all my contacts phone numbers?
I don't want to do it one by one and I need it for skype and other applications (including my cell phone)
Thank you.
7 replies
Sign in or join Beachball Help to reply.
- 0
Andreas Amann ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Open Script Editor (/Applications/AppleScript/Script Editor) and paste the following code:
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") then
set value of eachNumber to "1" & theNum
end if
end repeat
end repeat
save addressbook
end tellClick the green "Run" button and wait for the script to do its job (it will prepend all numbers with "1" unless they already start with either "1" or "+").
You might want to make a backup of your Address Book (File > Export > Address Book Archive… from the menu within the Address Book application) first so you can revert to what you had before if you don't like the results…
- 0
JimShaggy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Brilliant!! Worked awesome. The only thing I had to do was click compile first and then run. Thanks Andreas. Saved me a lot of time.
- 0
Avram Lewis ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I am so delighted to find this post, as I've been searching for ages for a similar solution. Must learn how to script one of these days!
For now, my situation is a bit more complicated. I have some international phone numbers, that already have a + and a country code. I have some international numbers that have a '011' and then a country code. I have some international numbers that just have a country code. I have a lot of North American phone numbers that already have a 1, but no +. And then I have a ton of North American phone numbers that just have the area code.
What I want to achieve is a "+1" for all North American numbers, a '+' in front of country codes for international numbers, and a '+' instead of the '011' for those that have that.
Is this script amendable to fit my circumstance?
many thanks in advance....
avi - 0
Avram Lewis ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
ps, Andreas, I recognize your name from your highly-praised Calling Card app for the iPhone. I was just looking at buying it today!
- 0
Swiss Mann ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I had a similar situation but instead of adding a 1 the phone numbers I needed to add an area code to take me from 7 digits to 10 digits. I used part of the script on this page and part on another page and it worked for me. I built a little website that explains how I did it. Thanks for the help!
Oh if you want to see what I did:
http://web.me.com/jacobcroft/AddArea_Code_to_AddressBook/HowToAreaCodePhone.html - 0
chesleyn ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
After 1 hour of searching I found this post and it worked for me. Thank you!
- 0
Jimotto ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Andreas, your script is wonderful however, I would like to add a space after the "1" so my number 1's don't bump up against the "(area-code)" in front of the number. This is my current layout (xxx) xxx-xxxx and I would like my new one to look like this, 1 (xxx) xxx-xxxx.
I am not sure how to add the space after the "1" and then the area-code then the number as indicated above.
Regards,
Jim Otto