I have the following script that allows me to add a specific description to all events in a specific calendar:
tell application "Calendar"
tell calendar "TEST"
set theEvent to every event
set description of every event to "hello world"
end tell
end tell
I’m not sure how to proceed with altering the code above to add the also include a copy of the title in the description. The reason is that the event will contain details of the day and needs the title referenced. I’ve tried using
set description of every event to "hello world" & summary
But this just errors. Could anyone help and point me in the right direction to allow me to add the title to the description?
Thanks!
Your code:
set theEvent to every event
creates a variable named theEvent that is a list of all Events. You need to loop through that list, and edit each Event individually:
repeat with oneEvent in theEvent
set oneEvent's description to (oneEvent's summary & "Hello Y'all")
end
Good luck,
Hi, Jordan. Your erring snippet is attempting to do something outside its scope; the event description has no knowledge of the summary. If you’d generically targeted the events”rather than an event property”that would’ve worked, however, this really requires a loop, so as to end with unique entries for unique events.
tell application "iCal" to repeat with anEvent in calendar "TEST"'s events
tell anEvent to set properties to {description:summary & " ” " & description}
end repeat
Sorry for the repetitive nature of the post. Craig got in there while I was still looking at the problem.
–edited for grammar
Thanks both of you for your help, worked perfectly!!!