Hi, Ok, this is also what I had in mind.
I will therefore abandon my first idea, and use a Python or StarBasic script to execute my job. Thank you again. Regards Thibault ----- Mail Original ----- De: "Mike Tonks" <[email protected]> À: [email protected] Envoyé: Mercredi 21 Juillet 2010 11:00:53 Objet: Re: [api-dev] execute jobs from command line Hi Thibault, Below is a simple example of a python script that will run from the command line - and tries to trigger a job. I don't actually have a job to trigger, so nothing happens, but it looks like it 'should' work. If you point me to a quick howto / example I could create a job and test it further. The example script is called py_trigger_test.py and can run from the command line (on linux): m...@nova:~/OpenOffice_UNO$ ./py_trigger_test.py X: pyuno object (com.sun.star.uno.XInterface)0x24809b8{implementationName=com.sun.star.comp.framework.JobExecutor, supportedServices={com.sun.star.task.JobExecutor}, supportedInterfaces={com.sun.star.lang.XTypeProvider,com.sun.star.lang.XServiceInfo,com.sun.star.task.XJobExecutor,com.sun.star.container.XContainerListener,com.sun.star.document.XEventListener,com.sun.star.lang.XEventListener}} Note the output X: shows the various interface details, python prints these nicely. #! /usr/bin/python #import socket # only needed on win32-OOo3.0.0 import uno # get the uno component context from the PyUNO runtime localContext = uno.getComponentContext() # create the UnoUrlResolver resolver = localContext.ServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", localContext ) # connect to the running office ctx = resolver.resolve( "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext" ) smgr = ctx.ServiceManager # get the central desktop object executor = smgr.createInstanceWithContext( "com.sun.star.task.JobExecutor",ctx) print "X: ", executor; executor.trigger("myservice"); NB: You need to have openoffice running in the background - I use: $ ooffice -headless "-accept=socket,host=localhost,port=8100;urp;" & Hope this helps. mike On 20 July 2010 21:34, Thibault Vataire <[email protected]> wrote: > Hi, > >> The py-uno api gives a very simple way to call ooo functions from the >> command line. > > Can you give me more details about what you have in mind. > > Thank you. > > Regards > Thibault > > > On 20 July 2010 10:25, Patrick Bernard <[email protected]> wrote: >> Hi >> >> I don't think it is possible to use a service from the command line. However, >> you can call a macro from the command line, and the macro can use your >> service. >> >> >> Regards >> >> Patrick >> >> Le mardi 20 juillet 2010, Thibault Vataire a écrit : >>> Hello, >>> >>> I've made a dummy service written in Python which load a new Writer >>> document. This service is registered as a job through an extension. >>> >>> If I invoke this service from a starbasic macro, it works great. >>> But my goal is to run this service from command line. >>> >>> I've tried something like this : >>> >>> <soffice_path>/soffice vnd.sun.star.job:service=the.name.of.my.service >>> >>> but nothing happens. >>> >>> Is there a way to execute a job/service from the command line ? >>> >>> Regards >>> Thibault >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
