Question

Is there a way to automate these steps?

  • open a LibreOffice ODT
  • update the TOC and other fields (e.g. via menu Tools|Update|Update All)
  • save and close the document
Was it helpful?

Solution

If you're using Windows, then this can be achieved very easily using Automa:

start("LibreOffice", r"c:\path\to\your\document.odt")
press(ALT + 't', 'u', 'u')
press(CTRL + 's')
press(ALT + F4)

You can save these 4 lines to a text file with the .at extension and play it back using Automa whenever required.

If you would like Automa to be able to find labels, click on menus etc. you need to go to Tools|Options|LibreOffice|Accessibility and tick the "Support assistive technology tools (program restart required)" checkbox. Then, for example the following will be possible:

start("LibreOffice", r"c:\path\to\your\document.odt")
click("Tools", "Update", "Update All")
press(CTRL + 's')
press(ALT + F4)

Disclaimer: I'm one of the Automa developers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top