tell application "Contacts"
repeat 50 times
set theGroup to group "MyGroupName"
delete theGroup
end repeat
save
end tell
It's a crude hack. I had to change "MyGroupName" five times, and when the replicant count dropped I had to reduce the repeat number so it would execute. (One could drop the count parameter and see if the repeat loop stops when it errors with "missing value"; that would be much faster. I was being cautious.)
At one point Contacts didn't respond very well. I quit and restarted and completed the process.
When I was done I confirmed iCloud's web view was also Group free. Then I purged all the Contacts in that account [3], it's now pristine.
I'm sure an AppleScripter could turn this into a general script for removing all groups all at once. Or could get very clever, and only remove groups that had no contacts (so one could salvage the group/contact relationships).
I didn't need that. My problem has been fixed.
Incidentally, I think iCloud sync works a lot better in ML than Lion. iCloud updated very quickly.
[1] I have 4 AppleIDs. Two or three of them have iCloud accounts. One has all of my iTunes and AppStore purchases. One was my MobileMe account. A third, which I've never used, acquired, apparently by email transfer, all of my Apple device records. Does Apple have any idea how screwed up their AppleID/iCloud accounts are?
[2] Of which Jamie Zawinski wrote: "I used to think that PHP was the biggest, stinkiest dump that the computer industry had taken on my life in a decade. Then I started needing to do things that could only be accomplished in AppleScript."
[3] They're safe in Snow Leopard until I move my primary machine to Mountain -- which might be sooner than expected. ML seems to be everything Lion should have been.
3 comments:
Spent hours on this problem myself. I have tried this script, and it runs but result is
missing value
Any idea what happened? I am a first timer at apple srcipting, (did the tutorial you suggested on Apple Forum. I am so unhappy and tears are streaming.
Sarah, I think your best bet is to find a friend who is a Mac geek and ask them to help run the script. Everyone needs a local Mac geek. They will usually work for wine or beer.
Well, turns out it DID work. I just had so many of the "untitled groups" (10,000+) that it didn't seem to be working at first. The system was over burdoned with the number of times I was running it and really slowed down, but the good news is it worked and then I drank the wine.
Post a Comment