Find and replace or batch change in Address Book?

vincentpace

Registered
I'm looking to convert a whole slew of telephone numbers in Address Book to make them Skype compliant. There are a variety of find-replace patterns I want to use. One example is an area code in parentheses. For example, I want to change (215) to +1 215. There are thousands of numbers in my address book to change, and manually is not an option.

Address Book doesn't have any way to do this on its own. I checked out Automator but it doesn't have many useful Address Book functions. I dug around for a bit online for an AppleScript that would just go straight to editing the AddressBook.data file, but didn't find anything.

I tried to edit the AddressBook.data file myself using TextWrangler, but when I saved it, AddressBook.data's icon changed from a blank file icon to a plain text file icon and Address Book stalled out while opening, necessitating a force quit. So I reverted to my back up and am no closer to solving the problem.

Is there a way to do a find-replace or a batch change in Address Book, whetever via AppleScript or otherwise?

If not, how can I edit AddressBook.data and save it without it become a text file that Address Book chokes on?
 
'Is there a way to do a find-replace or a batch change in Address Book, whether via AppleScript ...' - yes.

01. Create a duplicate or archive of your '~/Library/Applicaton Support/Address Book' folder.

Within 'Script Editor' (AppleScript editor application) -
02. Create a list of persons.
03. Cycle through the list of persons, creating a list of each person's phone numbers.
04. Cycle through the individual's phone numbers, modifying each phone number - into the desired format.
05. After cycling through the list of persons, save the address book - which saves all the changes.
 
So then one way to do it is to write an AppleScript. Do you know of anyone who has already done this? Or, at the very least, something similar? I'm pretty sure I could handle the minor changes in such a script (i.e., changing the find-replace patterns) but I wouldn't know how to hammer out from scratch a script that does what you suggest.
 
I also tried to use TextEdit to make textual changes to AddressBook.data with TextEdit's find-replace function. After using this, Address Book did not stall out when opening (although it took a while). Nevertheless, the changes I made were not reproduced in Address Book. Does Address Book try to back up data from somewhere else? Why is it that textual changes made directly in AddressBook.data and saved by TextEdit did not exist after opening the file with Address Book?

Is there a way to textually edit the AddressBook.data file, save it, and then open it in Address Book with the edits that you made?
 
Did you ever get this issue solved? I have a very similar problem and it drives me nuts. I like the integration of Address Book, but hate the crude data entry and lack of batch editing. Any ideas?
 
I usually make Address Book format the phone numbers to + 1 234 516 7890 or +1234567890 (of which the first one is easier to see at least for me).

Skype reads the numbers in either, or in any internationally accepted format. So even if it was +1-234-567-8900, (123)456-7890 or +39-(0)91-999 9999 format, they should still work for skype.

Do you actually get an error when using the phone numbers you have in your Address Book? As long as the country codes for the countries that are not where your Skype is based are present and clearly marked with a + or 00 (or 011 depending again where you are, so + is the clearest) it shouldn't complain. If there is an error, which is it?

If calling from usually Address Book side, try from Skype itself (or vice versa). In the preferences, as long as Show Address Book contacts is selected it should show all the recognized format phone numbers. Does that work or is there an error message? A different or same error?

But of course the numbers in logically the same format makes it much better looking.

So, Address Book > Preferences > Phone > tick "Automatically format phone numbers" and pick the format you prefer.

That will make all new contacts have the preferred format, which should prevent the ugly formats for the new contacts. But with hundreds or thousands of numbers, it would be neat if that same number formatting tab had an option to add it to all existing contacts too. I don't see how making that change in Address Book code would be too difficult to implement, so that sounds like something worth making a bug report or enhancement request for it.

I see a few scripts that may also help getting the desired format.
http://hints.macworld.com/article.php?story=20070316001856199 might be able to modified for the purpose
http://mac.softpedia.com/get/Utilities/Format-Address-Book-Phone-Numbers.shtml this one is rather old and may or may not even launch in 10.5 but again, the code may be useful
http://iharder.sourceforge.net/current/macosx/abs/ if you're in US or Canada this may also do what you want

Before trying with any script, make sure there's at least one complete and working backup of the AB database, just in case. :)
 
Thanks Ciaguara, but it's not only because of Skype that I want to change my current numbers.

I pretty much live in two countries so my address book is filled with numbers from these two places. I have continually used my own way to distinguish them so batch changing them shouldn't be difficult as the program would have an easy way to determine which numbers to change.

I also have over 1000 contacts with several numbers each, so doing it manually would be way too tedious.

Any other ideas?

Thanks in advanced!
 
Back
Top