15

I have an OpenOfice macro that I want to use to process the contents of an OpenOffice file. I am able to do this by opening the file with OpenOffice and then running the macro. How do I invoke the macro from the Linux command line without using the GUI? Something like:

$ oowriter -headless -o MyDocument.odt -RUNMACRO MyLittleMacro 
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
CW Holeman II
  • 3,654
  • 5
  • 31
  • 49
  • What about running a macro from a specific file? What would be the path to be used for invoking the macro in such a case? – anoopjohn Dec 25 '12 at 17:58

2 Answers2

4

The flag you want is -invisible. See this example, adapted from http://ubuntuforums.org/showthread.php?t=786697

ooffice -invisible macro:///Standard.Module1.SaveAsXHTML("/tmp/somefile.rtf")
jmtd
  • 9,255
  • 2
  • 25
  • 26
1

Create an event-driven macro assigned to the Open Document event for a particular document or a common document. Then you would load the document by itself to act on itself or load it along with other documents to act on one or more of them. This is along the lines of the idea of an auto-run macro.

Dennis Williamson
  • 6,620
  • 1
  • 34
  • 38
  • 1
    So, wht would the command line be to invoke an event-driven macro assigned to a common document to apply it to the document MyDocument.odt? – CW Holeman II May 19 '10 at 05:31