Nocton wrote: ↑Wed Dec 06, 2023 12:35 pm
... That's simple like VBA. Why does the recorder make such a complex issue of the matter?
If you develop custom code for document automation in AOO or in LibO, and are coming with experiences from VBA you need to undertsand first of all that VBA (here Excel-VBA) is a programming language
and the
ApplicationPropgrammingInterface (API) for the respective MS-Office application at the same time. The successors of StarOffice (OO.o, AOO, LibO) have a completely different concept:
The included API is something like a collection of "services" and related "interfaces" for using them. Every programming language (C++, C#, Java, Javascript, Python, ???) for which somebody created a sufficient "bridge" to the API can be used to create custom code. The included B
ASIC is a rather simple (poorly featured) programming language.
Its main purpose just is to call API services. And at this point it's OK, and sometimes preferrable: The bridge is short and wide, and some frequently needed elements are represented using predefined names.
The specialised B
ASIC has partly experimental Options
Code: Select all
Option Compatible
Option VBAsupport 1
trying to support the execution of B
ASIC code the way any VBA would do, respectively even as if the Excel API were avaiable.
Compare the sizes of an Excel
.exe and of the executable of "our" software (including
all the components!) and you will see that this can't be perfect.
But if you want to
try the Option
VBAsupport 1 with running your VBA code directly, you should
try a recent LibreOffice (a portable version without installation would do). The LibO branch of development did more for compatibility.
One point more: The macro recorder of "our" software is an additional feature. It doesn't create B
ASIC code actually equivalent to
written code, but just creates some lines allowing to execute dispatcher commands (.uno:command). Trying to do so it often has to create much more lines than hoped for and may end up with non-satisfying code needing manual reworking. In specific the recorder is not a logger for key-pressings and mouse-clicks.
If you consider to develop user code for "our" software more often, you should not start with recorded macros. They are misleading, and written macros very rarely have a reason to use the dispatcher.
Study the basics of B
ASIC usage in OpenOffice based on the famous texts by Andrew Pitonyak. They describe the (rather simple) B
ASIC features always regarding the special needs of API usage, and this way even teach the API usage more thoroughly than the B
ASIC.
See
https://www.pitonyak.org/oo.php .
On Windows 10: LibreOffice 25.2.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München