Can Country Code Be Removed From Contacts App on Macbook?

Discussion in 'Mac Programming' started by zumandrew, Mar 2, 2013.

  1. macrumors newbie

    Joined:
    Mar 2, 2013
    #1
    Hello,

    First time poster, longtime reader.

    Is there a way to remove the country field from the Contacts app? Instead of deleting each United States of America one contact at a time (2k+) perhaps an Apple script can resolve this issue? Or is there another automated way?

    Thanks for your help in advance!

    Cheers,

    Andrew
     
  2. macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    I'm guessing you mean Address Book. Try this :

    Code:
    -- USE THIS AT YOUR OWN RISK! MAKE A BACKUP BEFORE YOU APPLY IT TO YOUR ADDRESS BOOK!!!
    tell application "Address Book"
    	set my_selections to selection
    	repeat with my_selection in my_selections
    		repeat with i from 1 to count of every address of my_selection
    			if country of address i of my_selection = "United States of America" then
    				set country of address i of my_selection to ""
    			end if
    		end repeat
    	end repeat
    	save
    end tell
    
    Note : Before you run this make a BACKUP of your address book. Select all persons you want to remove the country field from and run the script.
     

    Attached Files:

Share This Page