Remove address fields from Mac address book using Applescript
        Posted  
        
            by cemregr
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by cemregr
        
        
        
        Published on 2009-12-27T09:15:36Z
        Indexed on 
            2010/03/31
            6:13 UTC
        
        
        Read the original article
        Hit count: 522
        
Hello,
A Facebook Sync app filled the address fields of my Mac Address Book contacts with their cities. Having tons of people who have useless addresses makes it difficult to search by people on Google Maps app (ending up scrolling through many many people- I only want to see those who have proper addresses entered).
I want to clear all the home address fields in my address book using applescript. I wrote something small but couldn't get it to work, probably needs some help from somebody who knows applescript :)
tell application "Address Book"
repeat with this_person in every person
        repeat with this_address in every address of this_person
            if label of this_address is "home" then
                remove this_address from addresses of this_person
            end if
        end repeat
     end repeat
 end tell
I tried to deduct the logic of multiple addresses/phones from other scripts but could only find adding them, not removing them.
Thanks! :)
© Stack Overflow or respective owner