OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Invoke an OO macro from shell

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
mlopes
Newbie
Newbie


Joined: 16 Feb 2005
Posts: 2
Location: Oporto

PostPosted: Wed Feb 16, 2005 2:31 am    Post subject: Invoke an OO macro from shell Reply with quote

Hi,

I'd like to know how can I make use of a OO.org macro from shell, without opening any instance of OO or connecting to a X server.

I've been using

Code:
/usr/bin/ooffice -headless -invisible 'macro:///ConversionLibrary.Conversions.ConvertToHTML(%s)' &> %s" % (infile, path_error + "/OOo2html.err"


But using this approach I need a X server running OR a virtual framebuffer, like xvfb. So, is there a way to call this very same macro without opening OO?

Best Regards
Back to top
View user's profile Send private message Visit poster's website
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Wed Feb 16, 2005 3:22 am    Post subject: Re: Invoke an OO macro from shell Reply with quote

mlopes wrote:
So, is there a way to call this very same macro without opening OO?

No

With kind regards
hol.sten
Back to top
View user's profile Send private message
mlopes
Newbie
Newbie


Joined: 16 Feb 2005
Posts: 2
Location: Oporto

PostPosted: Wed Feb 16, 2005 3:27 am    Post subject: Reply with quote

Well, when I say without opening, I mean without opening in visual mode. A script can be called within shell if it does not need access to Xserver.

Reformulating my questions.. is it possible to call OO from shell without establishing a connection to X?
Back to top
View user's profile Send private message Visit poster's website
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Wed Feb 16, 2005 6:19 am    Post subject: Reply with quote

mlopes wrote:
Reformulating my questions.. is it possible to call OO from shell without establishing a connection to X?

Sorry, but the answer is: No.

You have the possibility to start OOo in the so called "-headless" mode. But even in that mode, and really, that is the most invible mode of OOo, you need an X server, at least an xvfb.

With kind regards
hol.sten
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Sat Feb 19, 2005 9:06 am    Post subject: Reply with quote

If OOo is already open, then you could run a macro from the command line.

The running of the macro (per se) is not visible on the screen. Only the actions that the macro performs are visible. So if the macro does not do anything visible on the screen, then you won't see anything on screen.

If a macro creates or opens documents, they should be created with the Hidden property set to True. Then you won't see them on screen. BE SURE to close hidden documents from your macro, or else you won't be able to close them, because you cannot see them in the GUI.


See also....

Converting Word -> PDF from the command line
http://www.oooforum.org/forum/viewtopic.php?t=3772
http://www.oooforum.org/forum/viewtopic.php?t=5513
http://www.oooforum.org/forum/viewtopic.php?t=3768
PyOpenOffice tool to convert SXW to PDF without using OOo
http://www.oooforum.org/forum/viewtopic.php?t=12757

Convert Word --> Writer from the command line
http://www.oooforum.org/forum/viewtopic.php?p=24891#24891

Convert Excel -> PDF from the command line
http://www.oooforum.org/forum/viewtopic.php?t=5596
http://www.oooforum.org/forum/viewtopic.php?p=21050#21050

Convert SXC to CSV from commandline
http://www.oooforum.org/forum/viewtopic.php?t=6987

Convert PPT to HTML from command line...
http://www.oooforum.org/forum/viewtopic.php?t=5137






Command line arguments
======================
http://www.oooforum.org/forum/viewtopic.php?t=4899
http://fr.openoffice.org/Documentation/How-to/Basic/command%20parameters.htm
http://www.oooforum.org/forum/viewtopic.php?p=11058#11058
http://www.oooforum.org/forum/viewtopic.php?p=10972#10972
http://www.oooforum.org/forum/viewtopic.php?t=3548

See "The Office Headless Mode" at this site...
http://framework.openoffice.org/servlets/ProjectDocumentList

Passing array of arguments to macro
http://www.oooforum.org/forum/viewtopic.php?t=3745

Use .uno:Open to display open dialog
http://www.oooforum.org/forum/viewtopic.php?t=4224

Command-line options of StarOffice
http://www.oooforum.org/forum/viewtopic.php?t=1789

http://framework.openoffice.org/files/documents/25/806/Command_line_arguments_in_OpenOffice.html

Run Impress presentation from command line
http://www.oooforum.org/forum/viewtopic.php?t=1051



Executing Macros via. URL or command line
or via. dispatcher
=========================================

Use a macro:/// url via. the Dispatcher
http://www.oooforum.org/forum/viewtopic.php?t=6079

Start macro from commad line
http://www.oooforum.org/forum/viewtopic.php?t=7975

Open document, then run a document macro from command line
http://www.oooforum.org/forum/viewtopic.php?p=44925#44925

http://www.oooforum.org/forum/viewtopic.php?t=4071
http://www.oooforum.org/forum/viewtopic.php?p=15589#15589
http://www.oooforum.org/forum/viewtopic.php?p=9861#9861
http://www.oooforum.org/forum/viewtopic.php?p=17377#17377
http://www.oooforum.org/forum/viewtopic.php?t=3196
http://www.oooforum.org/forum/viewtopic.php?t=2619
http://www.oooforum.org/forum/viewtopic.php?p=11794#11794

http://www.oooforum.org/forum/viewtopic.php?p=13053#13053

http://www.oooforum.org/forum/viewtopic.php?t=4285

http://www.oooforum.org/forum/viewtopic.php?t=3772

http://www.oooforum.org/forum/viewtopic.php?t=4163

http://www.oooforum.org/forum/viewtopic.php?t=2688

Calling macro in different document, and pass parameter...
http://www.oooforum.org/forum/viewtopic.php?t=5564
Shorter technique, and also on a saved or Untitled document....
http://www.oooforum.org/forum/viewtopic.php?p=25232#25232
use a dot as document name to refer to current document
http://www.oooforum.org/forum/viewtopic.php?t=6808

Call macro in different document from VB and pass parameter...
http://www.oooforum.org/forum/viewtopic.php?t=6221
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
nensor
Newbie
Newbie


Joined: 24 May 2005
Posts: 1

PostPosted: Tue May 24, 2005 7:26 am    Post subject: Reply with quote

hol.sten wrote:
mlopes wrote:
Reformulating my questions.. is it possible to call OO from shell without establishing a connection to X?

Sorry, but the answer is: No.

You have the possibility to start OOo in the so called "-headless" mode. But even in that mode, and really, that is the most invible mode of OOo, you need an X server, at least an xvfb.

With kind regards
hol.sten


Pardon my ignorance, but what exactly is the use of "-headless" if it does still in fact connect to the X server? Myself, and I'm sure some others, are trying to "batch process" conversions (such as Word to PDF, or SXW to PDF, etc), and having to have an X server running (Solaris or Linux at least, have not tried this under WIndows) is problematic on some servers.

Will there be a future "macro only" or real "headless" option in OOo? At least for me, invoking the conversion macro with -invisible or -headless or combinations thereof still pop up the OOo Writer window, load a doc, then exit. I'd like it to process without all that overhead.

Thanks!

Neal Ensor
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Tue May 24, 2005 10:26 am    Post subject: Reply with quote

nensor wrote:
what exactly is the use of "-headless" if it does still in fact connect to the X server?

The use is, that OOo has not to paint anything. So using "-headless" you reduce the overhead as best as possible.

nensor wrote:
Myself, and I'm sure some others, are trying to "batch process" conversions (such as Word to PDF, or SXW to PDF, etc),

Your right. Even I use OOo that way.

nensor wrote:
and having to have an X server running (Solaris or Linux at least, have not tried this under WIndows) is problematic on some servers.

To run Xvfb is not problematic. Give it a try.

nensor wrote:
Will there be a future "macro only" or real "headless" option in OOo?

No idea.

nensor wrote:
At least for me, invoking the conversion macro with -invisible or -headless or combinations thereof still pop up the OOo Writer window, load a doc, then exit. I'd like it to process without all that overhead.

On Windows XP I don't have that problem. There is "-headless" in fact headless. On Solaris I honestly have no idea, because I use there Xvfb.

With kind regards
hol.sten
Back to top
View user's profile Send private message
bajzi
Newbie
Newbie


Joined: 06 Dec 2005
Posts: 2

PostPosted: Tue Dec 06, 2005 7:20 am    Post subject: putting command-line macro into OO Reply with quote

Hi everyone!

Maybe it's a trivial question for a lot of you but not for me and haven't found the answer to it in the forums:

1. I wrote my macro in a GUI under windoz - tested, works
2. Installed xvfb
But how can I put the macro into OO running on the server? Since I don't have a GUI on the server...

Please help! Thanks,

Andras
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Tue Dec 06, 2005 1:44 pm    Post subject: Re: putting command-line macro into OO Reply with quote

bajzi wrote:
Since I don't have a GUI on the server...

Is it possible to use the XServer of another pc like I wrote here http://www.oooforum.org/forum/viewtopic.phtml?t=20195&highlight=xdeep32? Scroll down to the short description of XDeep32.

With kind regards
hol.sten
Back to top
View user's profile Send private message
nashah25
General User
General User


Joined: 05 Oct 2006
Posts: 5

PostPosted: Thu Oct 05, 2006 9:25 pm    Post subject: Regarding : Macros in ooffice Reply with quote

Hi,
"ooffice -invisible "macro:///Standard.jpegconversion.SplitSlides(/opt/new_server/serverprog/bin/name.ppt)"

the -invisible command is not working, whenever i try this the X window is opening. is there any other it will not open the X window? please help me....
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Fri Oct 06, 2006 6:36 am    Post subject: Reply with quote

it seems Xvfb is your friend. See

Headless server problem: VNC as X Server http://www.oooforum.org/forum/viewtopic.phtml?t=34349&highlight=
start OO with no user interface and no X ? http://www.oooforum.org/forum/viewtopic.phtml?t=19790&highlight=
Xvfb not good enough - have to run X again? http://www.oooforum.org/forum/viewtopic.phtml?t=19947&highlight=
Xvfb howto on fedora 2 http://www.oooforum.org/forum/viewtopic.phtml?t=20195&highlight=
Opening a document in a hidden window? http://www.oooforum.org/forum/viewtopic.phtml?t=20256&highlight=
OpenOffice without the GUI http://www.oooforum.org/forum/viewtopic.phtml?t=30798&highlight=
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
AndrewZ
Moderator
Moderator


Joined: 21 Jun 2004
Posts: 4140
Location: Colorado, USA

PostPosted: Wed Feb 27, 2008 4:09 pm    Post subject: Re: Invoke an OO macro from shell Reply with quote

This is an old post, so the following is just for the record. People still read this stuff. Smile

mlopes wrote:
But using this approach I need a X server running OR a virtual framebuffer, like xvfb. So, is there a way to call this very same macro without opening OO?


Yes! OpenOffice.org 2.3.0+ Linux no longer requires an X server (not even Xvfb) if you install the headless RPM package and use the -headless option. IMO, -headless is easier than Xvfb.
_________________
<signature>
* Did you solve your problem? Do others a favor: Post the solution
* OpenOffice.org Ninja
* BleachBit
</signature>
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group