InfiniteGlass icon indicating copy to clipboard operation
InfiniteGlass copied to clipboard

Integration: LibreOffice

Open redhog opened this issue 5 years ago • 7 comments

Figure out a way to have LibreOffice save the list of currently open files on exit.

redhog avatar Feb 08 '20 22:02 redhog

@BackOrder do you have any experience scripting LibreOffice?

redhog avatar Feb 21 '20 14:02 redhog

Take a look at this: https://ask.libreoffice.org/en/question/78511/macro-code-to-switch-between-open-writer-documents/

IanTrudel avatar Feb 21 '20 22:02 IanTrudel

Ah that's a good start... So how do I run code at startup and at shutdown? And is it possible to call python code (which in turn can call smlib)?

redhog avatar Feb 21 '20 22:02 redhog

https://superuser.com/questions/1135850/how-do-i-run-a-libreoffice-macro-from-the-command-line-without-the-gui https://ask.libreoffice.org/en/question/145481/struggling-to-auto-run-a-macro/

There is a problem though. What happens when LibreOffice crashes? It won't be running the shutdown script.

IanTrudel avatar Feb 21 '20 22:02 IanTrudel

Hm, good question. I guess you could have it save state every now and then? What I'm thinking is run a script at startup that registers as an SMLib client, and on the SMLib save message, goes through the list of open windows and saves them, and saves that list, and generates a RestartCommand matching the saved list...

redhog avatar Feb 21 '20 23:02 redhog

LibreOffice has UNO to communicate with different programming language. The SDK is available for Python. That would be more in line with what you want to do.

https://help.libreoffice.org/6.3/en-US/text/sbasic/python/python_programming.html

https://api.libreoffice.org/examples/examples.html

https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Starting_OpenOffice.org_in_Listening_Mode

https://pypi.org/project/unotools/

IanTrudel avatar Feb 21 '20 23:02 IanTrudel

Moved the initial zoom problem to https://github.com/redhog/InfiniteGlass/issues/11

redhog avatar Feb 22 '20 22:02 redhog