Jump to content

Script to determine sunrise/sunset times etc.


gnolivos
 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 8 years later...

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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