How to set next trigger time for make new time date action

Posted on
Wed Apr 14, 2010 4:34 am
bob offline
User avatar
Posts: 500
Joined: Jun 14, 2006

How to set next trigger time for make new time date action

For

Code: Select all
make new time date action with properties {name:"someName", date trigger type:everyDay, next trigger time:"6:30am"}


how do I set the time for the next trigger time?

Posted on
Wed Apr 14, 2010 7:20 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to set next trigger time for make new time date acti

next trigger time is a read-only property (get vs get/set in the dictionary) - it's calculated by Indigo. Set the absolute trigger time or countdown delta (depending on what time trigger type you pick) and Indigo will set next trigger time for you. For instance, to make a time/date action that will execute today at 3:00pm:

Code: Select all
set theDate to current date
set hours of theDate to 15
set minutes of theDate to 0
set seconds of theDate to 0
make new time date action with properties {name:"someName", date trigger type:everyDay, time trigger type:absolute, absolute trigger time:theDate}


After doing that, next trigger time would be 3:00 pm today.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Apr 14, 2010 4:42 pm
bob offline
User avatar
Posts: 500
Joined: Jun 14, 2006

Re: How to set next trigger time for make new time date acti

Jay,

Maybe you could add this to the Wiki, it would be nice to see more "how to's" for Applescript.

Posted on
Thu Apr 15, 2010 3:55 am
bob offline
User avatar
Posts: 500
Joined: Jun 14, 2006

Re: How to set next trigger time for make new time date acti

Jay,

I get this error when I run your script suggestion;

"IndigoServer got an error: Can’t make class time date action."

Posted on
Thu Apr 15, 2010 7:53 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to set next trigger time for make new time date acti

Where are you running the script from (an external script, Script Editor, or embedded)? It's working fine for me like this:

Code: Select all
tell application "IndigoServer"
   set theDate to current date
   set hours of theDate to 15
   set minutes of theDate to 0
   set seconds of theDate to 0
   make new time date action with properties {name:"someName", date trigger type:everyDay, time trigger type:absolute, absolute trigger time:theDate}
end tell


From Script Editor (and Script Debugger for that matter). It's also running fine as an embedded AppleScript in Indigo. If you're running it embedded, add the tell block around it and see if that makes a difference. We've had a few recent cases where the AppleScript interpreter has gotten into some odd state that requires tells to work correctly even though they're running in the context of the IndigoServer process.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed May 18, 2011 2:54 pm
bob offline
User avatar
Posts: 500
Joined: Jun 14, 2006

Re: How to set next trigger time for make new time date acti

Jay,

Is is possible to have this script place the TDA in a specific TIME DATE ACTION folder?

regards,

bob

Posted on
Wed May 18, 2011 3:44 pm
bob offline
User avatar
Posts: 500
Joined: Jun 14, 2006

Re: How to set next trigger time for make new time date acti

Jay,

Is it possible with an Applescript to alter the time of an existing Time Date Action to have it action at a new time Sunset or Sunrise minus/plus x number of minutes? Or create with Applescript a new Time Date Action and specify its Action to run an Applescript?

thanks,

bob

Posted on
Wed May 18, 2011 4:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to set next trigger time for make new time date acti

bob wrote:
Is is possible to have this script place the TDA in a specific TIME DATE ACTION folder?


Nope - AppleScript doesn't know about folders so all new objects are placed at their root level.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed May 18, 2011 4:25 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to set next trigger time for make new time date acti

bob wrote:
Is it possible with an Applescript to alter the time of an existing Time Date Action to have it action at a new time Sunset or Sunrise minus/plus x number of minutes? Or create with Applescript a new Time Date Action and specify its Action to run an Applescript?


Yes, you can make one of those as well:

Code: Select all
make new time date action with properties {name:"Sunrise plus 10", date trigger type:everyDay, time trigger type:sunrise, sun delta:600}


Note, the sun delta (600) is in seconds, so that's going to set it to 10 minutes in the UI. Check the AppleScript dictionary for all the other properties that can get and set.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Oct 01, 2013 1:36 am
manders offline
Posts: 23
Joined: Jun 23, 2013

Re: How to set next trigger time for make new time date acti

Matt - Can you tell me the syntax for changing / editing an existing schedule?

Posted on
Tue Oct 01, 2013 8:18 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: How to set next trigger time for make new time date acti

Here is an example that changes an already existing absolute time schedule ("desk light schedule") to occur 10 seconds from the time you run it:

Code: Select all
tell application "IndigoServer"
   set curTime to current date
   set absolute trigger time of time date action "desk light schedule" to curTime + 10
end tell

Image

Posted on
Tue Oct 01, 2013 9:26 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: How to set next trigger time for make new time date acti

Will that then *permanently* set the schedule time, e.g. it won't revert to the origin schedule time after the next execution?

Posted on
Tue Oct 01, 2013 10:22 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: How to set next trigger time for make new time date acti

hamw wrote:
Will that then *permanently* set the schedule time, e.g. it won't revert to the origin schedule time after the next execution?

Correct. It is the same as editing it via the dialog in Indigo.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 30 guests