Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Recover corrupted Address Book data with group info' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Recover corrupted Address Book data with group info
Authored by: strahlenroboter on Oct 22, '07 01:00:43PM
Well, there are two things that I wanna comment here:

1. Place the forgotten function findAndReplace to the 2nd script from above
2. There's another single-step-way of rebuilding the groups out of categories which are being lost in the exports of Addressbook.app of OS X 10.4.10 (at least there)

1. If you use the 2nd script above with the filename abgroups1_scpt.txt you should add the following lines in order to use the function findAndReplace. (I just found that somewhere else on the net. It was stolen anyway before I found it. So, i'm sorry not to be sure about the author):


on findAndReplace(tofind, toreplace, TheString)
	set ditd to text item delimiters
	set text item delimiters to tofind
	set textItems to text items of TheString
	set text item delimiters to toreplace
	if (class of TheString is string) then
		set res to textItems as string
	else -- if (class of TheString is Unicode text) then
		set res to textItems as Unicode text
	end if
	set text item delimiters to ditd
	return res
end findAndReplace

2. Single-step-way of rebuilding the groups out of categories used in vcards
I had the problem that my Adressbook.app 4.0.5 (under OS X 10.4.10) could export all the data of my address entries well, but could not re-establish oder rebuild the group information which was correctly put under the key (identifier) 'CATEGORIES:' which is usually used in vcards. That's kind of bad. And Apple seems to be quite silent on the subject. I mean I was really looking around for a made sollution (that worked) on the web (because I don't like to build up an AppleScript at all). But I did not found anything, so I had to do something on my own anyway.

Actually there's another use for the script. I can use it for the exports my online addressbook which is driven by 'PHP iAddressbook 0.98' (see www.wacha.ch). A really good online solution where you don't need to be uncertain about the service you get from .Mac

So, just two more words about the script. After an export, you have usually a vcf-File with all the vcards inside. Open (and import) it with Addressbook, just as usual. You'll see the categories in the 'note' field. Now it's the turn of my script written in AppleScript: script-filename: cat2group-scpt.txt. It goes thru all the entries of the addressbook, grabs the assignment information (you would say, the groups or categories) out of the 'note' field, creates the groups and puts the data-entry into it. It should leave the real comments or notes just as is while the textual information about the categories will be deleted in the data-entry.

Try it out with an almost empty addressbook (less than 100 entries) to figure out if it works and how long it needs to fulfill. Backup your data before. With more than 800 entries in over 30 groups, it will take about half an hour to finish (on a Mac Book Pro 2.33 Ghz).

BTW, be sure that you export the 'note' field for not losing your comments (see AB.app -> Settings). For the script, it's not important.

Use a zipped version, if you don't wanna copy/paste the script in the script editor and lose probably some characters: directory listing of the script


[ Reply to This | # ]