
here's my snippet for timeofnextevent, and nameofnextevent
Here's how I did it in my system. I included this in an attachment script with other misc functions. Note that it ignores events that are not enabled.
- Code: Select all
using terms from application "IndigoServer"
on timeofnextevent()
set nextevent to date "Friday, April 4, 2025 12:00:00 AM"
repeat with thisevent in every time date action
if enabled of thisevent is true then
if (next trigger time of thisevent as date) < nextevent then
set nextevent to (next trigger time of thisevent as date)
end if
end if
end repeat
return nextevent
end timeofnextevent
on nameofnextevent()
set nextevent to date "Friday, April 4, 2025 12:00:00 AM"
repeat with thisevent in every time date action
if enabled of thisevent is true then
if (next trigger time of thisevent as date) < nextevent then
set nextevent to (next trigger time of thisevent as date)
set nexteventname to name of thisevent
end if
end if
end repeat
return nexteventname
end nameofnextevent
end using terms from
the initialization of the nextevent variable to a date in 2025 is a little ugly, but I wasn't sure of a more elegant way to do it.
Scott.