JavaScript macro reference

How can I get ANY information about JavaScript macro programming in LO? Are
there source code comments I could dig into? Reference for another language
that could be adapted to JavaScript?

I've already asked on ask.LO
<https://ask.libreoffice.org/en/question/98257/javascript-macro-reference/>
but apparently *there is no documentation for JavaScript macros*, which I
find really strange: why does LO even support JavaScript
<https://github.com/LibreOffice/core/tree/master/scripting/examples/javascript>
macros if there's no documentation about how to use the language?

You will find that documentation is not a strong suit with LO. I
commend them for trying but generally failing. If all you need is just
a guide to the most basic functions LO documentation will get you
through but don't expect to be carried any further.

I can understand you asking your question on this mail list but you
probably should post your question to the user list
"users@global.libreoffice.org" if you are hoping for a useful answer.
This "documentation@global.libreoffice.org" list is primarily for the
people who are actually writing the documentation.

Hi :slight_smile:
A quick search gave me this;
https://wiki.documentfoundation.org/Macros
but I didn't check all the sources it lists as you've probably already
been there, done that.

Is javascript better than Python or C++?

JavaScript is just more popular than any other language, because it works
both on the server (Node.js) and on the client (as the only scripting
language in the browser).

https://presencepress.presencepg.com/javascript-and-node-js-continue-to-eat-the-world-d41918a0615b

Given there is a choice and that most of LO's code is Python (afaik) is
Python likely to be a better choice?

No. The macro language is independent of the language LO was written in.

I don't know if the op's question is for existing macro(s) or for creating
new ones.

I know JavaScript and I just want to create a macro in Calc to fetch the
USD vs. EUR rate from a REST API, and copy that value from one cell to
another. I find it impossible to figure out where to start.

And I'm not alone - people who want to get started with writing macros have
a hard time as well:
https://stackoverflow.com/questions/21413664/how-to-run-python-macros-in-libreoffice

By comparison, it was far easier to get started with Excel's Visual Basic -
there was a clear reference, built into M$ Office.

Hi Dan

I know JavaScript and I just want to create a macro in Calc to fetch the
USD vs. EUR rate from a REST API, and copy that value from one cell to
another. I find it impossible to figure out where to start.

And I'm not alone - people who want to get started with writing macros have
a hard time as well:
https://stackoverflow.com/questions/21413664/how-to-run-python-macros-in-libreoffice

By comparison, it was far easier to get started with Excel's Visual Basic -
there was a clear reference, built into M$ Office

I don't follow your comparison, since Excel uses Visual Basic for
Application and LibreOffice has its own BASIC, IDE and API for almost
any kind of macro need, and documentation on LibreOffice Basic exist.

https://documentation.libreoffice.org/en/english-documentation/macro/

I can't verify ATM if Excel supports Python, Java and Javascript macros,
but LibreOffice does.

But the point on missing documentation for Javascript, Python and Java
is valid and deserves attention. We the community, is resource-short but
we left our wiki open for those who wants to write a tutorial about
these original forms of writing macros. Javascript and Python are both
languages of great popularity nowadays.

Cheers