Page 1 of 1

[ANSWERED]Enable Time/Date action in the future

PostPosted: Tue Dec 30, 2014 2:39 am
by SMUSEBY
I would like to enable a time/date action in "n" days. Below is my failed attempt to enable an absolute event for today. Neither "dt" or "the AS "current date" are acceptable to the Indigo AS Command "absolute trigger time to date "xxx"". Beyond that, I am unable to perform date math to add, say, 3 days to today. Is it possible to schedule an event for the future with AS? Is there a better alternative?

set dt to do shell script "/bin/date \"+%D, %H:%M\""
tell application "IndigoServer"
enable time date action "XYZ"
tell time date action "XYZ"
set date trigger type to absolute
set absolute trigger time to date dt --(also tried current date)
end tell
end tell

Re: Enable Time/Date action in the future

PostPosted: Tue Dec 30, 2014 10:18 am
by jay (support)
This will set it to the current date/time:

Code: Select all
tell application "IndigoServer"
    # Add 3 days to the current date. The add operator expects seconds so multiply it out.
    set nextExecutionTime to current date + (3 * (60 * 60 * 24))
    # Set the trigger time to that value
    set absolute trigger time of time date action "XYZ" to nextExecutionTime
end tell


Note, however, that you're not actually enabling/disabling the schedule but rather just changing when it will run. I don't know what your exact need is but actually enabling/disabling the schedule might be a better option.