Re: Problem with Address Book counting duplicates
Re: Problem with Address Book counting duplicates
- Subject: Re: Problem with Address Book counting duplicates
- From: Ron Hunsinger <email@hidden>
- Date: Tue, 27 Dec 2011 16:58:14 -0800
On Dec 26, 2011, at 12:13 PM, David Crowe wrote: Because of synchronization of my Address Book between multiple computers I've had a problem with duplicate records multiplying. Easy enough to write a script to find the same name/organization and delete the duplicates.
However, the job of gathering up the duplicates does not seem to work. The following test code:
set theName to "David Crowe"
tell application "Address Book" set theList to every person whose name is theName
set nDuplicates to count theList end tell
display dialog theName & ": " & nDuplicates
Reports 8 records when there are actually 24 with my name. Most other contacts with duplicates report a count of 2 records when there are more like 8. I don't see anything strange in the records like extraneous spaces or punctuation.
The next step I'd take is to see what's different among those 24 names, such that only 8 of them seem to match. Select all 24 of them (using command-click in Address book) and then run:
set theName to "David Crowe" set rslts to return tell application "Address Book" set theList to (get the selection) repeat with aContact in theList set rslts to rslts & (id of aContact) & ", " & (name of aContact) & ", " & ((name of aContact) is theName) & return end repeat end tell
rslts
Conversely, select the 8 matches, and see if there's a pattern to them. (They're all consecutive, they're all in the same group, whatever...)
set theName to "David Crowe"
tell application "Address Book" set selection to (get every person whose name is theName) end tell
-Ron Hunsinger |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden