I’m trying to put together an applescript to text-message me certain events by using an alarm to send an e-mail. The trouble is, I can’t seem to get the proper event. I read in another post here that I was looking for the “last event”, but that seems to return a totally random event, unrelated to whatever triggered the alarm. Here is the current code, for reference:
on getNextEvent()
set theEventText to null
tell application "iCal"
activate
set theEvent to the last event of calendar "School"
set theEventText to summary of theEvent
end tell
return theEventText
end getNextEvent
I had a similar problem. What you’re script is really doing is getting the last event item of the calendar, not the last occured event. You can see my solution in iCalMail.
I actually tried something along those lines originally, but it didn’t work for recurring events (i.e. the start date of a recurring event seems to be only its first occurrence.) Have you figured out a way around that, or do you have the same trouble?