[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
dukevir
Guest

 Posted: Mon Apr 19, 2004 12:20 am    Post subject: Start macro from commad line i start a text document whit the commad line: \soffice.exe -o the question is: Can I start also a macro to command line? thanks
elehenaff
Power User

Joined: 16 Apr 2004
Posts: 76
Location: paris - france

 Posted: Mon Apr 19, 2004 12:31 am    Post subject: yes! i did by storing my macro in the soffice macro subtree and launched it by typing : H:\>"C:\Program Files\OpenOffice.org1.1.1\program\soffice.exe" macro:///Standard.Module1.message(2) as u can see, u can even pass parameters to your macro.
dukevir
Guest

 Posted: Mon Apr 19, 2004 6:21 am    Post subject: thanks elehenaff
Peter O
Guest

 Posted: Fri Jun 18, 2004 12:21 am    Post subject: additional question Starting a macro this way works just fine. But how do I make OpenOffice close again after the macro has finished ? I'm trying to manipulate around 1000 documents and I don't think that having 1000 copies of OpenOffice running on my system is going to be very efficient.
Guest

 Posted: Fri Jun 18, 2004 1:50 am    Post subject: idea Maybe you could put that in the end of the macro code? self.close() or something?
Peter o
Guest

 Posted: Fri Jun 18, 2004 2:02 am    Post subject: Sorry, this gives "BASIC runtime error Object variable not set"
Cybb20
Super User

Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

 Posted: Fri Jun 18, 2004 5:54 am    Post subject: use thisComponent.close(true) and then Stardesktop.terminate() at the end. This should do what you want._________________- Knowledge is Power -
DannyB
Moderator

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

Posted: Fri Jun 18, 2004 6:17 am    Post subject: Re: additional question

 Peter O wrote: Starting a macro this way works just fine. But how do I make OpenOffice close again after the macro has finished ? I'm trying to manipulate around 1000 documents and I don't think that having 1000 copies of OpenOffice running on my system is going to be very efficient.

It is not necessary to make OOo close after each time you call a macro from the command line. Each command that runs soffice.exe with a macro will run the macro within the copy of OOo that is already open and running. You will not end up with 1000 copies running.

Only at the end, once, do you need to make OOo quit. You can do this by calling a second macro that makes OOo quit.
http://www.oooforum.org/forum/viewtopic.php?t=9942
Depending on your needs, it may not even be necessary for you to close OOo at the end of the 1000 document conversion.

Another possibility is that you might want to close OOo after every, say, 50 documents are converted. That way, on the 51st document, 101st document, etc., a new copy of OOo is launched.
_________________
Want to make OOo Drawings like the colored flower design to the left?
fgomes
Newbie

Joined: 12 Aug 2004
Posts: 3

 Posted: Thu Aug 12, 2004 3:28 pm    Post subject: Can I put more than one argument for the macro? Using the command line macro calling, can I put more than one argument? It worked for me with one paramenter but when I tried to put 2 arguments in the macro, and then calling it from the command line the second paramenter is not passed. Command line: soffice macro:///Standard.Module1.Macro1("abc", "def") Macro: Sub Macro1(a As String, b As String) MsgBox a & " " & b End Sub Is it possible to do it? Am I doing something rong? Thanks in advance Fernando
sasol
Newbie

Joined: 13 Aug 2004
Posts: 2

 Posted: Fri Aug 13, 2004 4:08 am    Post subject: what if my macro is in some specific file, eg test.sxc??
DannyB
Moderator

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

Posted: Fri Aug 13, 2004 5:38 am    Post subject:

 sasol wrote: what if my macro is in some specific file, eg test.sxc??

Do this....

 Code: soffice "C:\Documents and Settings\dbrewer\Desktop\test.sxc" "macro://test/Standard.Module1.MeowMix()"

(Note, the above is one long command line, not multiple lines.)

First you get a dialog that complains about the document having macros, but not being in the path of documents trusted to run macros. Click Run.

Then you get the MsgBox, because the macro code in the document sez...
 Code: Sub MeowMix    MsgBox "MeowMix" End Sub
HexTA
General User

Joined: 06 May 2006
Posts: 13

Posted: Fri May 12, 2006 7:47 am    Post subject:

 Quote: Do this.... Code: soffice "C:\Documents and Settings\dbrewer\Desktop\test.sxc" "macro://test/Standard.Module1.MeowMix()" Code: Sub MeowMix MsgBox "MeowMix" End Sub

doesn't work
SergeM
Super User

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

 Posted: Fri May 12, 2006 8:20 am    Post subject: See : simple command line question http://www.oooforum.org/forum/viewtopic.phtml?t=2619&highlight= How to convert Word -> PDF from the command line http://www.oooforum.org/forum/viewtopic.phtml?t=3772 Creating PDF at commandline (with compression) http://www.oooforum.org/forum/viewtopic.phtml?t=33047&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
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
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