Hi, I'm working on my first masterpiece as a newbie to applescript that I wrote during my lunch break, although I do have experience scripting in unix korn shell - most of this is not yet tested as I have to go home before I can try it out. I've pieced it together using snippits of code from other scripts in this forum, and have guessed at some of the wording as I forgot to bring a printout of the Indigo dictionary. Let me know if you see anything that stands out as a syntax error as it may save me some time tonight. One thing I was confused on was where I needed to place Indigo variables in quotes, and where I don't - or should they always be in quotes? I know applescript local variables don't need quotes but that may not apply to Indigo variables since they would be an application variable. I'm also wondering what the syntax is for sending an all off to a house code, for example all lights off to house code F to save having to send out individual off commands during the day (as kids sometimes turn on lights during the day at the switch & forget to turn off). Thanks : )
-- note: depends on nightly enablment of FishLightActive variable
tell application "Indigo"
if daylight then
log "Andrews motion during daylight"
remove delayed actions for device "Andrews Light"
remove delayed actions for device "Andrews Closet"
turn off "Andrews Light" in 10 * 60
turn off "Andrews Closet" in 10 * 60
else -- it is nighttime
if (FishLitTime <= 120) then
if (FishLightActive = true) then
if (on state of device "Andrews Fish Light" is false) then
log "Turning on Andrews Fish Light"
turn on "Andrews Fish Light" for 10 * 60
set value of variable "FishLitTime" to "FishLitTime" + 10
remove delayed actions for variable "FishLightActive"
set value of variable "FishLightActive" to False
set value of variable "FishLightActive" to True in 8 * 60
else -- fish light is already on
log "Leaving Andrews Fish Light on additional 10 min's"
remove delayed actions for device "Andrews Fish Light"
turn off "Andrews Fish Light" in 10 * 60
set "FishLitTime" to FishLitTime + 8
remove delayed actions for variable "FishLightActive"
set value of variable "FishLightActive" to False
set value of variable "FishLightActive" to True in 8 * 60
end if -- state of fish light
remove delayed actions for device "Andrews Light"
dim "Andrews Light" 15% in 35 * 60
turn off "Andrews Light" in 40 * 60
else -- FishLitTime has reached daily limit
set value of variable "FishLightActive" to False
set value of variable "FishLitTime" to 0
log "Andrews fishlight has reached limit - disabling until next night"
end if -- daylight
end tell