How to put multiple macros inside one setup oxt file

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
dziglo
Posts: 11
Joined: Wed May 24, 2023 2:36 pm

How to put multiple macros inside one setup oxt file

Post by dziglo »

Hello!
Please help.
How can I put several macros written in one of the languages ​​allowed in LibreOffice (let's say Basic) in one oxt file?

That is, when you run (double-click) the oxt-file, all these macros will be installed.

For now, there is an oxt file that, when installed, adds a spell check in some language.
And you need to add a macro there, which will perform a simple replacement (like this: find “g”, replace with “u”).
OpenOffice 3.1 on Windows 10
User avatar
Hagar Delest
Moderator
Posts: 32628
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: How to put multiple macros inside one setup oxt file

Post by Hagar Delest »

Hi and welcome to the forum!

That is what I do also, to quickly reinstall all my custom macros at once.
See: [Solved] How to back up macro library files.
When you modify a macro, then just export again the relevant module, and open the .oxt with an archive manager (it is actually a mere zip archive), then replace the old file(s) by the new one(s).

Please add [Solved] at the beginning of the title in your first post (top of the topic) with the 🖉 button if your issue has been fixed.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
dziglo
Posts: 11
Joined: Wed May 24, 2023 2:36 pm

Re: How to put multiple macros inside one setup oxt file

Post by dziglo »

Hagar Delest wrote: Wed May 24, 2023 2:45 pm Hi and welcome to the forum!

That is what I do also, to quickly reinstall all my custom macros at once.
See: [Solved] How to back up macro library files.
When you modify a macro, then just export again the relevant module, and open the .oxt with an archive manager (it is actually a mere zip archive), then replace the old file(s) by the new one(s).

Please add [Solved] at the beginning of the title in your first post (top of the topic) with the 🖉 button if your issue has been fixed.
Hi!
Maybe I did not write my question quite accurately (for your forum I write in another language and Google translates it for me).
I know that oxt is zip.
I have an oxt file that sets up spell checking for one specific language.
And I also have a small macro in OpenOffice Basic.
I need to embed this little macro into my finished oxt file.
So that when installing the oxt file (double-click), the following happens:
1) install spell checker
2) that macro will be installed.
OpenOffice 3.1 on Windows 10
User avatar
Hagar Delest
Moderator
Posts: 32628
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: How to put multiple macros inside one setup oxt file

Post by Hagar Delest »

I don't know how dictionaries are packaged in extensions. Thus, don't know if you can package a macro library and the spell check feature in the same extension. But if the addons.xcu file is well formed, then it may be possible.
Try to compare the files between a simple extension with a macro and yours with the spell checking part.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: How to put multiple macros inside one setup oxt file

Post by JeJe »

I don't know how dictionaries are packaged in extensions either but normally you put the macros in a library and the library becomes part of the extension.

Take a look at Extension Compiler

https://wiki.openoffice.org/wiki/Extens ... n_Compiler
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
dziglo
Posts: 11
Joined: Wed May 24, 2023 2:36 pm

Re: How to put multiple macros inside one setup oxt file

Post by dziglo »

Hagar Delest wrote: Wed May 24, 2023 3:55 pm I don't know how dictionaries are packaged in extensions.
Aren't all spell checking services for OpenOffice/LibreOffice packed into an oxt file?
And the spellcheck files themselves inside oxt have the Hunspell standard.
There are examples here:
https://extensions.libreoffice.org/?sta ... s%5B%5D=58
Hagar Delest wrote: Wed May 24, 2023 3:55 pmTry to compare the files between a simple extension with a macro and yours with the spell checking part.
How can I do that?
OpenOffice 3.1 on Windows 10
User avatar
Hagar Delest
Moderator
Posts: 32628
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: How to put multiple macros inside one setup oxt file

Post by Hagar Delest »

dziglo wrote: Wed May 24, 2023 4:21 pm Aren't all spell checking services for OpenOffice/LibreOffice packed into an oxt file?
And the spellcheck files themselves inside oxt have the Hunspell standard.
Yes but macros and dictionaries are not the same thing.

To compare extensions, since they are mere zip files, unzip one that contains a simple macro and study its content. I think that most of the settings are in the addons.xcu file. The trick will be to have one that declares both the files for the spell check and the library for the macro.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
dziglo
Posts: 11
Joined: Wed May 24, 2023 2:36 pm

Re: How to put multiple macros inside one setup oxt file

Post by dziglo »

Hagar Delest wrote: Wed May 24, 2023 6:40 pm
dziglo wrote: Wed May 24, 2023 4:21 pm Aren't all spell checking services for OpenOffice/LibreOffice packed into an oxt file?
And the spellcheck files themselves inside oxt have the Hunspell standard.
Yes but macros and dictionaries are not the same thing.
And if we are talking about two macros in BASIC or Python (and not about spell checking). How, then, to combine them in one oxt file?
OpenOffice 3.1 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to put multiple macros inside one setup oxt file

Post by Villeroy »

Tools>Macros>Organize>Basic...
Button [Organizer]
Tab [Libraries]
Choose the library and export as oxt. This will not work with the special library named "Standard". You have to save the macros in a specifically named Basic library.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: How to put multiple macros inside one setup oxt file

Post by JeJe »

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply