MacOS – Removing only birth years from a group in the Address Book

applescriptcontactsmacos

A lot of my contacts (600+) had somehow got their birth years set to 2000. Their birth months and days are correct, but the 2000 is wrong.

With the tremendous help I got here, I was able to get them in one group (which I called 2K).

I would like to remove the birth years from those cards, while retaining birth months and days.

On my OS X 10.8.5 it can even be done manually, but not on adayzdone's 10.6.8.

Can anybody provide a script (for 10.8.5)?


So, I would like to turn

enter image description here

into

enter image description here

using AppleScript rather than doing it manually. And not just November 10.

Best Answer

Ok. Since you have your group already you group.

set targetGroup to "BD" 
tell application "Contacts"
    set thePeople to people of group targetGroup
    repeat with i from 1 to number of items in thePeople
        set this_item to item i of thePeople
        set thisDate to birth date of this_item
        set year of thisDate to 1604

        set birth date of this_item to thisDate
        save
    end repeat


end tell

I tried to set the year to "" . But it changes the whole date. day and month to something else.

So I checked what a yearless birth date 'date' looked like and they all had 1604 in the year position.

setting the year to this seems to work.