View unanswered posts | View active topics It is currently Sat May 18, 2013 3:46 pm



Reply to topic  [ 3 posts ] 
 Time 'til next action? 
Author Message

Joined: Dec 02, 2006
Posts: 25
Post 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


Tue Jul 24, 2007 5:59 pm
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11679
Location: Texas
Post 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


Tue Jul 24, 2007 9:50 pm
Profile WWW

Joined: Dec 02, 2006
Posts: 25
Post 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.


Sun Aug 12, 2007 8:50 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.