cootetom Newbie

Joined: 29 Nov 2011 Posts: 3 Location: United Kingdom
|
Posted: Tue Nov 29, 2011 2:05 am Post subject: Multiple Impress documents at once |
|
|
Hello,
I've wrote a python script to create an Impress document using pyuno. It works great if I create a new document one at a time but as soon as I run the script two or more times at once I get really weird results. Each document will contain random bits of data from any of the other documents in any order. It's like when it has something ready to place into a document then it will just pick any open document at random to put that content in. I end up with multiple documents but with completely random data inside.
I'm just wondering if this is possible or if I need to stick to one document at a time?
Here is the code I have for connecting to a document...
| Code: |
self.oo_process = subprocess.Popen(['C:\Program Files (x86)\OpenOffice.org 3\program\simpress.exe',
'-accept=socket,host=localhost,port=2002;urp;',
'-headless', '-invisible', '-nocrashreport', '-nodefault',
'-nofirststartwizard', '-nologo', '-norestore',
])
time.sleep(5)
# connect to the current office application running on the desktop.
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
'com.sun.star.bridge.UnoUrlResolver',
localContext)
self.ctx = resolver.resolve('uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext')
smgr = self.ctx.ServiceManager
desktop = smgr.createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)
# load a blank presentation into the desktop instance
self.document = desktop.loadComponentFromURL('private:factory/simpress', '_blank', 0, ())
|
There is then code to put slides and content into the document but it always works with self.document from then on. _________________ - Tom |
|