|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Creating Date/Time Events
| Author |
Message |
|
NewbieAutomator
Joined: Mar 14, 2008 Posts: 8 Location: Toronto
|
 Creating Date/Time Events
Hello, all.
Is there a way to create a date/time action from an applescript. For instance, I would like to create a watering schedule from a web page where the page defines all of the parameters (days of the week, zones, times, etc.) and uses them to create a new date/time action.
Thanks.
|
| Tue Aug 19, 2008 8:04 am |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6662 Location: Austin, Texas
|
Untested:
- Code: Select all
tell application "IndigoServer" set actionName to "Some Name" set actionDescription to "Some autocreated date/time trigger action" set actionTriggerTime to "8/20/2008 4:30PM" make new time date action with properties ¬ {name:actionName, ¬ description:actionDescription, ¬ time trigger type:absolute, ¬ date trigger type:absolute, ¬ absolute trigger time:(date actionTriggerTime), ¬ enabled:true} end tell
Note that you can create all the variations of date/time triggers by changing the various properties. Look at the IndigoServer dictionary in Script Editor to see the specifics.
jay
|
| Tue Aug 19, 2008 4:31 pm |
|
 |
|
trekinsanity
Joined: Sep 11, 2004 Posts: 40
|
I am not finding anything in the IndigoServer Dictionary to setup the conditions. How can I make a new time/date in AppleScript and setup the conditions?
|
| Sun Aug 09, 2009 3:43 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6662 Location: Austin, Texas
|
trekinsanity wrote:I am not finding anything in the IndigoServer Dictionary to setup the conditions. How can I make a new time/date in AppleScript and setup the conditions?
You currently can't create conditions when creating triggers or time/date actions from AppleScript - the condition will default to "always". There are a few things that you can't do in AppleScript and that happens to be one. It's on the enhancement list however, so it could show up someday but probably not before 5.0... 
_________________ Jay (Indigo Support)
|
| Sun Aug 09, 2009 4:09 pm |
|
 |
|
gregjsmith
Joined: Apr 01, 2003 Posts: 823 Location: Rio Rancho, NM
|
I'm essentially using contional time/date actions, but I'm putting the applescript conditions in the excutional part of the time/date action. I start with the following function:
- Code: Select all
on MakeTrigger(TriggerName, TriggerTime, ScriptText) tell application "IndigoServer" if not (time date action TriggerName exists) then set newTimeDateAction to make new time date action with properties {name:TriggerName, date trigger type:absolute, absolute trigger time:TriggerTime, auto delete:true} tell first action step of newTimeDateAction set action type to executeScript set script code to ScriptText end tell else set absolute trigger time of time date action TriggerName to TriggerTime end if end tell end MakeTrigger
Using it might look something like this: - Code: Select all
set devname to "Living Room Lights" MakeTrigger("_auto_on_" & devname, (current date) + 30, "turn on device \"" & devname & "\"")
It looks messy because of all the escaping of quotes, but I've written some complex applescript using this method including full lists of conditional logic.
_________________ Greg In The Desert
|
| Sun Aug 09, 2009 7:05 pm |
|
 |
|
trekinsanity
Joined: Sep 11, 2004 Posts: 40
|
Thank you both! I was figuring that it wasn't in AppleScript yet. Greg, thanks for the input.
|
| Tue Aug 11, 2009 7:33 am |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: Bing [Bot] and 2 guests |
|
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
|
|