Created
January 21, 2013 14:37
-
-
Save vtim/4586508 to your computer and use it in GitHub Desktop.
Query iCal events from MacRuby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/macruby | |
framework 'calendarstore' | |
thirty_days_ago = NSDate.dateWithString((Time.now - (30 * 3600 * 24)).to_s) | |
today = NSDate.date | |
store = CalCalendarStore.defaultCalendarStore | |
predicate = CalCalendarStore.eventPredicateWithStartDate(thirty_days_ago, endDate:today, calendars:CalCalendarStore.defaultCalendarStore.calendars) | |
store.eventsWithPredicate(predicate).each do |event| | |
if event.title.downcase.include? "test" | |
puts "#{event.startDate.strftime('%d-%m-%y')}\t#{event.title}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
08-01-13 New Test | |
15-01-13 iOS test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment