I Would Like to Learn a Macro Language LO 5.0

I'm running LibreOffice 5.0 on Windows 10.
I really enjoy LibreOffice, and I would like to write some simple macros to get even more value out of LibreOffice. Writing macros will be my first programming experience, but would provide the most benefit for my profession since I mostly produce documents, spreadsheets, and presentations in my vocation since I do a lot of teaching. I found some materials to assist with learning and getting started with LibreOffice Basic:
   - https://wiki.documentfoundation.org/Macros 
   - https://help.libreoffice.org/Common/Scripting

However, while looking through the LibreOffice 5.0 Help documentation, I found this under LibreOffice Basic / Basic / programming page:
Programming LibreOfficeLibreOfficecan be controlled by using the LibreOffice API.

> LibreOffice provides an Application Programming Interface (API) that enables you to control LibreOffice components by using various programming languages. A LibreOffice Software Development Kit is available for the programming interface. |

> For more information about LibreOffice API reference, please visit http://api.libreoffice.org/ |

> Macros created with LibreOffice Basic based on the old programming interface will no longer be supported by the current version. |

Formore information on LibreOffice Basic, select "LibreOffice Basic" inthe list box.
So before I start investing a lot of time in learning LibreOffice Basic, would I be better served learning to script macros in a different language that would then access the LibreOffice API?If so, which language works best using LibreOffice 5.0 on Windows 10 to write macros?
Possible Macros that I would like to create:- A macro that automates the formatting of a paragraph, changing the style, superscripting numbers, etc...- A macro that provides a quick way to look for Creative Commons graphics by opening a browser search page. (It would be similar to the "Research" panel in Google Docs)- A macro that provides a quick way to look up a meaning of a highlighted word in an online dictionary.
 ---------------------------- | Steve | | mowestusa@yahoo.com | ----------------------------

I do not have time to review all of this, but...

Ultimately, all supported languages use the same internal API, it is mostly a question of which language you prefer to use. External languages are generally more difficult to use initially because there are usually external things that you must link to. The do provide more flexibility than the built-in Basic because of their external libraries, better IDEs, and similar. On the other hand, Basic provides many things for free. For example, when you have an object (say a document, or a graph), that object typically will support services and interfaces. I won't trouble you with the details on this, but,

Suppose that an object supports an "index container" interface that lets me access the contained things based on a numerical interface. Before I can use that interface in Java or C++ (which I don't generally use to control LO), I must access that interface. There are two difficulties with this. First, I need to know which interface I need to get and second, I need to go to the trouble of getting it. This might not be overly difficult, but, with BASIC, that is generally hidden from you so you can directly use all of the interfaces on the object. It just makes it a bit easier. Sorry, I did not take the time to make this more clear, but, I have a class I need to go teach now.

Do you have a link to where you found the above quote? At least taken out of context, it looks very wrong. (So I would assume "old programming interface" and "current version" actually refer to ancient history, fully irrelevant now.)

e.g. here: https://help.libreoffice.org/Common/Programming

Nino

Hi,

Nino Novak schrieb:

> > Macros created with LibreOffice Basic based on the old
programming interface will no longer be supported by the current version. |

Do you have a link to where you found the above quote?

e.g. here: https://help.libreoffice.org/Common/Programming

That is helpcontent2/source/text/shared/main0600.xhp
Best would be to remove it. But I don't have looked which bookmarks and index entries have to be changed then. At least the section 'id="basicalt"' has to be removed totally. The current one is in helpcontent2/source/text/sbasic/shared/main0601.xhp.

Please write a bug report.

Kind regards
Regina

Nino Novak schrieb:

> > Macros created with LibreOffice Basic based on the old
programming interface will no longer be supported by the current
version. |

Do you have a link to where you found the above quote?

e.g. here: https://help.libreoffice.org/Common/Programming

That is helpcontent2/source/text/shared/main0600.xhp

And that line is in there ever since <http://cgit.freedesktop.org/libreoffice/help/commit/?id=4f48bcc7937fbc586af7720d4225768ee6913e2a> "#i33146# Initial checkin," which confirms my assumption that it is a dead, historic remark.

Best would be to remove it. But I don't have looked which bookmarks and
index entries have to be changed then. At least the section
'id="basicalt"' has to be removed totally. The current one is in
helpcontent2/source/text/sbasic/shared/main0601.xhp.

Please write a bug report.

So I'll leave it to others who are knowledgeable about helpcontent2 to get this fixed.

Writing macros will be my first programming experience,

This is a huge problem. Starting with UNO and StarBasic is the worst
entry point I can think of. You will have a very hard learning
exprerience because UNO is far too big and too complex for a beginner.
No matter how far you get with UNO and StarBasic, you will not end up as
a programmer.
UNO makes professional programmers cry and StarBasic does not make
anything easier because this language is out of date, buggy, poorly
documented, does not fit into its UNO surrounding, offers a very poor
set of functionality (compared to JavaScript and Pyhon) and it is
totally useless outside its UNO cage. The old literature on Visual Basic
does not apply very well and the existing literature presumes that you
are a (VBA-)programmer already.
This is like learning how to fly in a 747 cockpit (UNO) sitting on a
garden chair (StarBasic) as pilot seat.
Learning object oriented programming with Java, JavaScript or Python is
easy nowadays. Coming back to UNO with certain concepts and tools will
take you much further with less effort.

I dare say most airline pilots, with early childhood imagination, started in exactly this way. One can imagine the arm actions and the sound effects!

Brian Barker

Andreas,
Thank you for your reply. You made some excellent points that make sense. JavaScript is one of the options that I was considering because I would then be able to use my knowledge for other programs that have adopted JavaScript as their macro language of choice (like Google Docs). At the same time, I have no desire to jump from macro writing to full programming. I love my profession, but I would like to enhance my day to day usage of LibreOffice to save clicks of the mouse and pecks on the keyboard. A few basic macros would allow me to add functionality that may not be practical features for the LibreOffice programmers to code for releases. I thought it might be best to just use StarBasic by studying the materials that Andrew Pitonyak has provided and other sources that I highlighted in my first message thinking it might be the fastest way to accomplish the tasks I wanted to do.

I would be interested in hearing your thoughts on learning JavaScript (also what resources you recommend) and using that as my macro language of choice with LibreOffice.