use scripting additions
use framework "Foundation"
use framework "EventKit"
-- get the event store
set theEKEventStore to current application's EKEventStore's alloc()'s initWithAccessToEntityTypes:1 -- work around enum bug
-- get calendars that can store events
set theCalendars to theEKEventStore's calendarsForEntityType:0 -- work around enum bug. Sigh
-- get the calendars whose title is "Work" or "Home" -- change to suit
set theNSPredicate to current application's NSPredicate's predicateWithFormat_("title IN %@", {"Work", "Home"})
set calsToSearch to theCalendars's filteredArrayUsingPredicate:theNSPredicate
-- create start date and end date for occurences
set startNSDate to current application's NSDate's |date|() -- now
set endNSDate to current application's NSDate's dateWithTimeIntervalSinceNow:(7 * days) -- a week away
-- find matching events
set thePred to theEKEventStore's predicateForEventsWithStartDate:startNSDate endDate:endNSDate calendars:calsToSearch
set theEvents to (theEKEventStore's eventsMatchingPredicate:thePred)
-- get titles and display them
set eventString to (theEvents's valueForKey:"title")'s componentsJoinedByString:", "
display dialog eventString as text