Ask Your Question

Exit LO with a terminal command such as killall?

asked 2020-05-07 23:48:18 +0100

Mik3e gravatar image

I want to be able to use a script file to exit and save on the way to a shutdown. Can it be done?


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-05-08 10:10:13 +0100

blashrkh gravatar image

updated 2020-05-08 10:27:37 +0100

Have you tried killall --HUP, --SIGKILL and --SIGTERM options and tested to see if they work? Some applications detect HUP signals and can be used to close apps gracefully, but not sure whether this is implemented in LO. Probably not the best way to exit out of LO because it might not always save all data.

Probably the simplest way is to save file and exit using a macro. Although primative you might have an internal LO macro read a "STATE_FILE" indicating whether you wish LibreOffice to exit or not, and have the macro checking periodically whether STATE_FILE is true or contains a certain setting. When the time is ready to exit the program just write true to STATE_FILE.

Apparently you can run python macros from the command linerun python macros from the command line (from within a python file) to programmatically control LibreOffice. Apparently python uno allows control over the user interface of LibreOffice. There is a list of uno commands which includes saving, save as, quit/exit, etc.

Some other python related material below, but I would try the options above first.

If you are game you might try using java sdk and explore the libreoffice java functions

If this answer helped you, please accept it by clicking the check mark ✔ to the left and, karma permitting, upvote it. That will help other people with the same question. In case you need clarification, edit your question (not an answer) or comment the relevant answer.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2020-05-07 23:48:18 +0100

Seen: 111 times

Last updated: May 08 '20