#!/usr/bin/env python2.3 import AddressBook import sys import Foundation book = AddressBook.ABAddressBook.sharedAddressBook() addressBookPeople = book.people() birthdaysChanged = 0; currentTimeZone = Foundation.NSTimeZone. systemTimeZone() for person in addressBookPeople: birthday = person.valueForProperty_('Birthday') if (type(birthday) == AddressBook.NSCalendarDate): """They have a birthday""" newBirthday = Foundation.NSCalendarDate.alloc().initWithYear_month_day_hour_minute_second_timeZone_( birthday.yearOfCommonEra(), birthday.monthOfYear(), birthday.dayOfMonth(), birthday.hourOfDay(), birthday.minuteOfHour(), birthday.secondOfMinute(), currentTimeZone) person.setValue_forProperty_(newBirthday,"Birthday") birthdaysChanged = birthdaysChanged + 1; if (birthdaysChanged > 0): AddressBook.ABAddressBook.sharedAddressBook().save() print str(birthdaysChanged) + " birthdays changed and saved." else: print "No birthdays changed!"