As part of the script that I am writting to use with my alarm system, I want to compare whether the current time is before or after sunrise/sunset.
Here is what I came up with, but it does not work correct.
sub main()
dim currenttime
dim sunset
dim sunrise
sunset = hs.sunset
sunrise = hs.sunrise
currenttime = formatdatetime (time, vbshorttime)
msgbox currenttime & " sr: " & sunrise & " ss: " & sunset
if (curerenttime <= sunrise) or (currenttime >= sunset) then
hs.speak "It is dark outside"
else
hs.speak "It is light outside."
end if
end sub
Can anybody help me out on this.
Regards Willem-bram
Here is what I came up with, but it does not work correct.
sub main()
dim currenttime
dim sunset
dim sunrise
sunset = hs.sunset
sunrise = hs.sunrise
currenttime = formatdatetime (time, vbshorttime)
msgbox currenttime & " sr: " & sunrise & " ss: " & sunset
if (curerenttime <= sunrise) or (currenttime >= sunset) then
hs.speak "It is dark outside"
else
hs.speak "It is light outside."
end if
end sub
Can anybody help me out on this.
Regards Willem-bram
Comment