AppleScript saves the day

So I developed this small problem with iCloud where my contact groups started multiplying. I ended up with close to 200 copies of each of about 15 groups. Try deleting a group in Address Book. See how it takes about 5 seconds before you can move onto the next one? See how there’s no “select all” for groups? It would have taken hours to manually delete all of those groups. A nice AppleCare adviser is looking into this for me, but in the meantime, I think I’ve figured out a workable solution involving AppleScript.

Now you really should backup your Address Book before you do this. I like to create an Address Book archive and also select all and export vCards.

Actually, nevermind. Just don’t do this. Forget I ever laid it out as a possibility. You’ll probably do something horrible to you data.

repeat 1000 times
     tell application “Address Book” to activate
     tell application “System Events”
          tell process “Address Book”
               tell menu bar 1
                    click menu item “Delete Group” of menu “Edit”
               end tell
          end tell
          key code 36
          delay 5
     end tell
end repeat

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s