Time 'til next action?

Posted on
Tue Jul 24, 2007 5:59 pm
SSneddon offline
Posts: 25
Joined: Dec 02, 2006

Time 'til next action?

The main window shows a value for time to next action. Is there a way to get this in an applescript?

Thanks,

Scott

Posted on
Tue Jul 24, 2007 9:50 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Time 'til next action?

Hi Scott,

The only way to get it from AppleScript is to loop through all of the time date actions looking for the most recent next trigger time property.

Regards,
Matt

Posted on
Sun Aug 12, 2007 8:50 am
SSneddon offline
Posts: 25
Joined: Dec 02, 2006

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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron