Jump to content

Recommended Posts

Posted

I have created a script to AutoIT with a function called IsItDark that will return 1 if dark, and return 0 if daylight (based on your location).

The function is used like this:

IsItDark ($longitude, $latitude, $tzoff, $DSTactive)

So, with this function, you can do whatever you want when it is dark -- automatically!

Requires AutoIT v3.x (link to page)

There is also a function in there that will give you the exact sunset/sunrise times if you want that...

See attached files, and also look at the example provided.

Enjoy!

IsItDark.zip

Posted

I have created a script to AutoIT with a function called IsItDark that will return 1 if dark, and return 0 if daylight (based on your location).

The function is used like this:

IsItDark ($longitude, $latitude, $tzoff, $DSTactive)

So, with this function, you can do whatever you want when it is dark -- automatically!

Requires AutoIT v3.x (link to page)

There is also a function in there that will give you the exact sunset/sunrise times if you want that...

See attached files, and also look at the example provided.

Enjoy!

nice job, looks a little to much math for me but cool.

It would be great to have a address to lat/long converter then use IsDark.au3

Check out ConsultingJoe.com
  • 8 years later...
Posted (edited)

Nice script!

Thank you for "translating" it from this page: http://www.paulsadowski.com/WSH/suntimes.htm

The original author was probably more a math-wizard than a programmer, with variable names like $qqq and the absence of commentary...

I found http://itouchmap.com/latlong.html very handy when determining my Latitude and Longitude.

Also http://www.timeanddate.com is good for finding out the "UTC TimeZone offset" and if "Daylight Savings Time" is on or off.

Edit: Apparently https://www.timeanddate.com/ is better for visually impaired user

Once again: thanks!

Edited by Melba23
Added another link
Posted

Awesome!, didn't know someone created a function (math) for the lat/long lines

 

 

There is also a function in there that will give you the exact sunset/sunrise times if you want that...

That would be nice :)

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

  • 10 years later...
Posted

Many thanks from the future, nearly 19 years later!  I just used this in a project to schedule outdoor lighting via X10.  (Yeah, X10 is ancient but still useful.  And yeah, X10 already has software that does this based on sunrise/sunset, but mine (and your) software seems much more reliable. 🙂)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...