On starting up, and every day at midnight, XTension will automatically calculate the sunrise and sunset times for your location.
If you have properly set your latitude and longitude for your location using the Time and Date preference panel and your Mac's clock is correct then XTension will do a reasonable job of calculating the expected times of sunrise and sunset. The XTension preferences window also has a Suntimes setup dialog where you can enter a more accurate location or enter offsets:
If there are things that you always want to do at sunrise and/or sunset then you must create these scripts and include the instructions you want.
Xtension maintains a set of internal variables which hold today's sunrise and sunset times.
These variables represent the calculated time of the current day when sunrise and sunset will occur at the latitude/longitude that you have entered in your preferences.
In addition, XTension maintains a variable named daylight which can be used in conditional scripts. You cannot set or modify daylight directly, this is done automatically by XTension but is based on your preferences setting and offsets as already described.
if daylight is false then turn on "Front Door Light" end if
write log "Sunrise occurs today at " & time string of (sunrise) write log "Sunset will be at " & time string of (sunset)
There are 2 verbs for calculating the sunrise or sunset times for any given date.
set theDate to date "12/25/2012" write log "Sunrise for Christmas will be at: " & sunrise for theDate