[Solved] Detect if LibreOffice Extension is installed and activated

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
dhoelzl
Posts: 2
Joined: Mon Nov 28, 2022 4:57 pm

[Solved] Detect if LibreOffice Extension is installed and activated

Post by dhoelzl »

Hello!

We are developing an extension with VB macros for LibreOffice.
Our macros are then called via

Code: Select all

soffice.com --nodefault --norestore "macro:///<OurLibrary>.<OurModule>.<OurMacroFunction>(<Arguments>)"
This works perfectly fine if the user has installed our extension. However if the extension is not installed, just nothing happens. No output to stdout/sterr, and the exit code is still zero, like on the successfull call.

Is there any (clean) possibility to check if the user has installed the extension from external?
Is there a possibility to return a value from the macro?

Probably one workaround would be to add a macro function which writes something into a file passed by an argument, and then check if the data was written or not, but that's a workaround that I would like to avoid.

Thank you and regards,
Dominik
Last edited by dhoelzl on Tue Nov 29, 2022 10:41 am, edited 1 time in total.
LibreOffice Community 7.4.3.2 (x64) Windows
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Detect if LibreOffice Extension is installed and activated

Post by Villeroy »

C:\Program Files\OpenOffice4\program\unopkg list apso.python.script.organizer
returns all info about installed apso.python.script.organizer
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
dhoelzl
Posts: 2
Joined: Mon Nov 28, 2022 4:57 pm

Re: Detect if LibreOffice Extension is installed and activated

Post by dhoelzl »

Thank you, that resolves my problem.
In my case I have to call "C:\Program Files\LibreOffice\program\unopkg.bin" list org.openoffice.legacy.<ExtensionName>.zip and check the output for "is registered: yes", the exit code is zero if it exists and 1 if not.
LibreOffice Community 7.4.3.2 (x64) Windows
User avatar
LibreOfficiant
Posts: 12
Joined: Wed Jan 25, 2017 9:36 pm

Re: [Solved] Detect if LibreOffice Extension is installed and activated

Post by LibreOfficiant »

libO 5.4 64bit, (PortableApps: libO 6.0, aOO 4.1, OOo 3.2 32bit) on Win7/Win10 x64 | aOO 4.1.x & libO 5.4.x on Mint 18 Sarah & OSX 10.9 Mavericks x64
Python toolbox: Geany, PyCharm and APSO, MRI extensions..
https://wiki.documentfoundation.org/Macros/Design_Guide
Post Reply