I have this little script that I worte (my first):
on summerise_event(the_event)
set the event_properties to the properties of the_event
set this_summary to the summary of the event_properties
set this_location to the location of the event_properties
if this_location is missing value then set this_location to "No Location"
set start_date to short date string of (get start date of the event_properties)
set end_date to short date string of (get end date of the event_properties)
set event_description to the description of the event_properties
set event_summary to "Summary: " & this_summary & retunrn & "Location: " & this_location & return & "Start Date: " & start_date & return & "End Date: " & end_date & return & "Notes: " & event_description & return
display dialog event_summary buttons {"Ok"} default button 1
return the event_summary
end summerise_event
the_event is an iCal event. The code is almost a copy/past of the “Create Event Summary” script from apple. when I run the script I get this error:
What is it that I’m doing wrong? Also if I comment out the summary line the location line gives me the same error!
It may have been how you were calling the handler from your script. This works for me:
tell application "iCal"
set a to first event of calendar "Work"
end tell
set b to summerise_event(a)
b
on summerise_event(the_event)
tell application "iCal"
set the the_props to the properties of the_event
set this_summary to the summary of the the_props
set this_location to the location of the the_props
if this_location is missing value then set this_location to "No Location"
set start_date to short date string of (get start date of the the_props)
set end_date to short date string of (get end date of the the_props)
set event_description to the description of the the_props
set event_summary to "Summary: " & this_summary & return & "Location: " & this_location & return & "Start Date: " & start_date & return & "End Date: " & end_date & return & "Notes: " & event_description & return
display dialog event_summary buttons {"Ok"} default button 1
end tell
return the event_summary
end summerise_event
I made a few changes to some of your variable names, and added an iCal tell block to the handler.