forked from pixmeo/osirix
-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
iCal script.applescript
68 lines (58 loc) · 2.12 KB
/
iCal script.applescript
1
if application "iCal" exists then try tell application "iCal" --activate if source_calendar = "" then set the source_calendar to "OsiriX" end if set the the calendar_list to the source_calendar set the summary_range to "Today" set the range_indicator to 1 set current_date to the current date set the range_text to "TODAY" end tell set the master_data to my calendar_events(source_calendar, current_date, range_text) return master_data end tryelse return ""end ifon calendar_events(source_calendar, event_time, range_text) tell application "iCal" set this_calendar to the first calendar whose title is the source_calendar set the returned_events to every event of this_calendar whose start date is less than or equal to event_time and end date is greater than or equal to the event_time set these_events to {} repeat with i from 1 to the count of the returned_events set this_item to item i of the returned_events if the class of this_item is event then set the end of these_events to this_item else if the class of this_item is list then repeat with z from 1 to the count of this_item set this_event to item z of this_item if the class of this_event is event then set the end of these_events to this_event end if end repeat end if end repeat set the event_count to the count of these_events --set the event_summary to "CALENDAR: " & source_calendar & return & "EVENTS FOR " & range_text & return & "TOTAL EVENTS: " & (the event_count as string) --if the event_count is 0 then -- return the event_summary --else -- set the event_summary to the event_summary & return --end if set location_text to "" repeat with i from 1 to the event_count set this_event to item i of these_events set the event_properties to the properties of this_event set this_location to the location of the event_properties if location_text is "" then set the location_text to this_location else set the location_text to location_text & tab & this_location end if end repeat return location_text end tellend calendar_events