[Solved] Connect to LO Portable UNO using BASIC

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
DonnyH
Posts: 5
Joined: Mon Dec 04, 2023 10:36 pm

[Solved] Connect to LO Portable UNO using BASIC

Post by DonnyH »

Good morning all,
I’m hoping this is the right place to post this. I will start off by saying thank you very much for this forum, it has helped immensely to overcome previous problems. But, today I haven’t had any success in solving my problem.
As a bit of a background, I am not a programmer by ANY means. However I have been using a programming language called AutoIt to help automate some tasks in L.O. (AutoIt is a Basic Scripting language). A friend and I are attempting to create a UDF (User-Defined Function) to help other users automate tasks in L.O. using AutoIt. It is going well so far, but a user mentioned that this UDF will not work with the Portable Version of L.O., and this got me interested in how much work it would be to be able to connect to the Portable Version of L.O. I have done some searching online, but haven’t found anything too helpful yet. As best as I can tell I need to create a manifest file for the DLL containing the ServiceManager, and then somehow work with that using the Registry Free COM method. Which is all largely over my head. :)
Does anyone know of anyone else that has connected to a portable version of L.O. using an external basic language ? Or does anyone have some hints on how this might be accomplished? Or if it is even possible?
Thank you for any help,
Donny
P.S. sorry for any nonsensical terminology.
Last edited by MrProgrammer on Wed Feb 28, 2024 7:03 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
LibreOffice 7.3.4.2 on Windows 7 64 bit
JeJe
Volunteer
Posts: 2785
Joined: Wed Mar 09, 2016 2:40 pm

Re: Connecting to L.O. Portable UNO using BASIC language

Post by JeJe »

What tasks are you automating in LO? You can likely do it from within LO Basic, especially on Windows where you can declare Windows API calls and use those.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Mountaineer
Posts: 318
Joined: Sun Sep 06, 2020 8:27 am

Re: Connecting to L.O. Portable UNO using BASIC language

Post by Mountaineer »

From AutoIt description:
It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks
So the question is: Why should it not work?
Have you tried?

At this stage my only guess would be you identify the target window or task and there may be changed titles. The same problem would arise, if one is using LibreOffice instead of OpenOffice.
Does anyone know of anyone else that has connected to a portable version of L.O. using an external basic language ? Or does anyone have some hints on how this might be accomplished? Or if it is even possible?
The typical way to "connect to" LibreOffice is its own server mode, started via command-line switch --accept
This is in no way specific to a language like Basic (I guess it may be easier in more advanced languages than Beginners All-purpose Symbolic Instruction Code...)

An example may be this little framework:
https://appyframe.work/168
OpenOffice 3.1 on Windows Vista
User avatar
Greengiant224
Posts: 283
Joined: Wed Jun 09, 2010 3:50 pm
Location: All Over The World

Re: Connecting to L.O. Portable UNO using BASIC language

Post by Greengiant224 »

What the OP is looking for is a way to use autoit to connect via COM (registry free method if possible)
for a portable version of AOO/LO.

Autoit will connect to AOO/LO via COM if it is installed to the hard drive, unfortunately the portable version
is just that, portable and doesn't work the same.

Perhaps starting an instance of the portable version first will enable this to work?

Good luck

Win 7, Portable AOO 4.1.14, LibreOffice 6.2, 7.4.5 & 7.6.1 (Java 1.7.81 & 1.8.0_281) utilising HSQL 1.8.10 & 2.4.*, MySQL, PostgreSQL, SQLite
+ Blood, Sweat and Tears (Application, Determination and Perseverance)
DonnyH
Posts: 5
Joined: Mon Dec 04, 2023 10:36 pm

Re: Connecting to L.O. Portable UNO using BASIC language

Post by DonnyH »

Thank you everyone for your replies!
You can likely do it from within LO Basic
Yes, I have since learned the LO BAsic language well enough (Thanks to A. Pitonyak's book) that I can now automate the tasks I originally needed to, using that. But now I am more looking to enable users to use AutoIt to automate tasks also, such as modifying Par. Styles, inserting tables, etc., etc.
So the question is: Why should it not work?
Have you tried?
As Greengiant224 mentioned I am looking for using the LO API UNO/COM objects to accomplish this using AutoIt. I could use mouse and keyboard commands, but that kind of automation is very, very fragile. I was hoping to be able to use Object calls instead, which are much less likely to go wrong.
I could look into the server mode, thank you very much!
Perhaps starting an instance of the portable version first will enable this to work?
Good luck
Thank you Greengiant224, I'll look into that too.
LibreOffice 7.3.4.2 on Windows 7 64 bit
Post Reply