Applescript: Removing all addresses/employers from Address Book

Discussion in 'Mac Programming' started by pad07, Jun 24, 2010.

  1. pad07 macrumors regular

    Joined:
    Jul 29, 2007
    #1
    Anyone know if it's possible to remove all home address and company fields in Address Book using Applescript?

    Thanks in advance for any help!
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
  3. hhas macrumors regular

    Joined:
    Oct 15, 2007
    #3
    Off the top of my head:

    Code:
    tell application "Address Book"
    	tell every person
    		set company to false
    		delete (every address whose label = "home")
    	end tell
    	save addressbook
    end tell
    Untested, so you'll need to run it to see if it actually works. (Backup your address book's contents first, of course.)
     
  4. pad07 thread starter macrumors regular

    Joined:
    Jul 29, 2007
    #4
    Thank you!

    This works for deleting addresses, but not for clearing the Company field.

    Any ideas for that?
     

Share This Page