Happy Nu Year: Friends and Events

Here’s a little script that dumps the contents of your address book and your iCal events for the past year. The iCal part uses the Leopard-only CalendarStore interface.

#!/usr/bin/env nush
(load "AddressBook")
(((ABAddressBook sharedAddressBook) people) each:
 (do (person) (puts (person description))))

(load "CalendarStore")
(((CalCalendarStore defaultCalendarStore) eventsWithPredicate:
  (CalCalendarStore eventPredicateWithStartDate:
       (NSDate dateWithNaturalLanguageString:"1/1/2007")
       endDate:
       (NSDate dateWithNaturalLanguageString:@"12/31/2007")
       calendars:
       ((CalCalendarStore defaultCalendarStore) calendars))) each:
 (do (event) (puts (event description))))

Comment on this post ↓

Leave a Comment (sign in with Twitter)