Applescript to Merge Address Card entries


I just got a new toy, the IRIS II Business Card Reader but now I need to merge cards with previous entries.

In address book it is possible to merge cards but finding the duplicates can be a pain. Fortunately a simple Applescript comes to the rescue:

tell application "Address Book"
	repeat with currentEntry in people
		set currentName to name of currentEntry
		try
			set duplicateEntries to (every person whose name is currentName)
			if (count of duplicateEntries) > 1 then
				activate
				set selection to duplicateEntries
				tell application "System Events"
					tell process "Address Book"
						tell menu bar 1
							tell menu bar item "Card"
								tell menu "Card"
									click menu item "Merge Cards"
								end tell
							end tell
						end tell
					end tell
				end tell
			end if
		on error msg
			display dialog currentName & ":" & msg
		end try
	end repeat
end tell
In order to use this script you will need to have System Events activated. As for the scanner, it works really well and only takes 15-30s per card to scan and double-check the OCR. I'm really surprised that online companies like LinkedIn don't have a special relationship with these types of products. Scanning in all my business cards from Web 2.0, uploading the results to LinkedIn, and sending out invitations was trivial and could be even better integrated.
I'd like to recognize Bob Pasker as the original instigator of this little script, he did it in Cocoa-Python long before I did it in Applescript.

Posted: Mon - October 11, 2004 at 12:21 PM           |


©