Jump to content

SunMoon calculator


ravkr
 Share

Recommended Posts

This script calculates information about the Moon and the Sun (position on the sky, rise, transit, set, Moon phase etc.)
Just enter your longitude and latitude wait a second :D
 

moon3.gif

 
Maybe I'll add ISS, asteroids and planets but I don't promise anything.
 
Needed help with translating!
If you want to translate it to your language just copy section (eg. [English]) from lang.ini, translate all messages and post it here :)
 
Report any bugs.
 
Feedback is welcome :)
 
PS. It's my first script published on this forum
Edited by ravkr
fixed links

Link to comment
Share on other sites

there is no space before "Then"

 

>Running AU3Check (3.3.13.0)  from:C:Program Files (x86)AutoIt3  input:L:AU3AU3_z_Forumsunmoon_v1sunmoon.au3
"L:AU3AU3_z_Forumsunmoon_v1sunmoon.au3"(1096,27) : error: missing separator character before keyword.
  If IsArray($BlankBox[0])Then
  ~~~~~~~~~~~~~~~~~~~~~~~~^
L:AU3AU3_z_Forumsunmoon_v1sunmoon.au3 - 1 error(s), 0 warning(s)

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

do not use magic number
 
look in 
WindowsConstants.au3
 

Global Const $WM_SYSCOMMAND = 0x0112

look in
MenuConstants.au3

Global Const $SC_CLOSE = 0xF060

 



 
please use tidy.exe (CTRL+T in SciTE4AutoIT)
 

Func OnSysCommand($hWnd, $Msg, $wParam, $lParam)
;~      ConsoleWrite($hWnd & @TAB & $Msg & @TAB & $wParam & @TAB & $lParam & @LF)
    If BitAND($wParam, 0xFFF0) = 0xF060 Then
        If $hWnd = $GUI Then
            stop()
        EndIf
    EndIf
EndFunc   ;==>OnSysCommand

first check $hWnd and after that check $wParm

Func OnSysCommand($hWnd, $Msg, $wParam, $lParam)
;~      ConsoleWrite($hWnd & @TAB & $Msg & @TAB & $wParam & @TAB & $lParam & @LF)
    If $hWnd = $GUI Then
        If BitAND($wParam, 0xFFF0) = 0xF060 Then
            stop()
        EndIf
    EndIf
EndFunc   ;==>OnSysCommand

 


When I change Language then Window is moving to the bottom right corner of screen.



 
read some about variable names


btw.

Very good script, especially the concept and implementation of the GUI.

 

Dzięki za podzielenie się skryptem i tym samym wiedzą.

Thanks for sharing the script and the same knowledge.

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

>Running AU3Check (3.3.11.6)  from:C:\Users\hppc\Desktop\autoit-v3.3.11.6\install
"C:\Users\hppc\Downloads\sunmoon_v1\sunmoon.au3"(145,40) : warning: $ghGDIPDll: possibly used before declaration.
    Local $aResult = DllCall($ghGDIPDll,

error

autoit version: autoit-v3.3.11.6

os :win8

I was still using 3.3.9.24 :/

in new version of GDIPlus.au3 $ghGDIPDll is replaced with $__g_hGDIPDll

I'll fix it in few minutes ;)

Fixed

now it works for old and new UDF :D

 

Edited by ravkr

Link to comment
Share on other sites

Those functions are also included in the GDIPlus.au3 already!

--> _GDIPlus_TextureCreate and _GDIPlus_BitmapCreateFromScan0

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Those functions are also included in the GDIPlus.au3 already!

--> _GDIPlus_TextureCreate and _GDIPlus_BitmapCreateFromScan0

Br,

UEZ

it's my first script with GDI+ :P

I just copied these few lines from veeeery old tutorial :D

Edited by ravkr

Link to comment
Share on other sites

This looks fantastic and it's a really good idea: quite different from the majority of example scripts posted here. I guess it depends on the intended use, but I was wondering if including some different calendar systems might be useful - perhaps to historians of astronomy. You would need to be selective - using only those calendars which are linked to ancient astronomical observations. This is just an idea and it may require some study - or you might find advice from an online astronomical community. Great idea from you, thanks. :)

Link to comment
Share on other sites

Going far back in time is difficult and full of pitfalls in the case where accuracy is important. Various calendars have not taken their effect uniformly (very far from that) and neither at a precise date in general. So an old event dated with some old calendar in historical documents may have been shifted in time significantly by local unexpected adjustment. In all cases this would be a real mess to get that right despite the various bodies of universe not behaving randomly.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Going far back in time is difficult and full of pitfalls in the case where accuracy is important. Various calendars have not taken their effect uniformly (very far from that) and neither at a precise date in general. So an old event dated with some old calendar in historical documents may have been shifted in time significantly by local unexpected adjustment. In all cases this would be a real mess to get that right despite the various bodies of universe not behaving randomly.

 

Ah! Very good point. Also many ancient observations were made with imprecise calibration, such as arm length; or stranger still, the size of your earlobe. I read some text about an Egyptian (or Indian) method where two scribes sat opposite one another, night after night, making observations with an hourglass. When a star appeared behind your colleagues head, ear, or another part of their body, the time and position of the celestial appearance was logged. These ancient texts read something like:

'Betelgeuse ascends the right shoulder after seven and a quarter turns (of the glass)'. :D

I believe that quite a lot of celestial data was recorded this way, over quite a long period of time. I can just imagine the puzzlement on the faces of the historians when they first tried to decipher these ancient writings - 'OMG what have we got here?'. Of course the significance of the text is not immediately apparent.

Edited by czardas
Link to comment
Share on other sites

@czardas & jchd:

It's not necessarily always that bad. For example, Stephenson et al. (see here or here or here) used historical solar eclipses to reconstruct the changes in earth's diurnal rotation due to tidal friction and postglacial rebound over several thousand years, going back to Babylonian times.

Calendars can be confusing, but for example the adherence and transition from Julian to Gregorian ( shift of 10+x days, x depending on the reference century) in European sources is often consciously expressed by the author during the period that both systems were used side by side, or can be deduced from other sources with known calendar style that describe the same event.

Complications arise with New Year's Style (instead of Jan 1, maybe Mar 1, or Easter (which moves with the lunar cycle), for example), so you'd read about an event happening in Feb year X, only to discover later that the source used Easter Style, so in modern reckoning it was already year X+1 (this happened to me). Unlike Julian/Gregorian, that's the kind of shift size that really matters when reconstructing geo/astrophysical dynamics. At the other end of the spectrum, historical clock time (uncalibrated by astronomical events such as Venus transits) is often impossible to reconstruct  (in Medieval times, even the next village could be in a different time zone), and local time can be  dependent on the choice of prime meridian, and that is itself a can of worms (there have been hundreds used in the historical past, often without explicit identification). Use of different calendars is far less of a headache in that respect.

Edited by RTFC
Link to comment
Share on other sites

You're right. Having been a time nut list follower for long time I know that going back in time is harder than within distinct calendars. Even keeping time isn't as easy as it sounds.

In any case, kudos for your app.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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...