Lawrence D'Oliveiro wrote:
In message <[EMAIL PROTECTED]>, norseman
wrote:
The OOo examples do not work.
I have done OOo scripting in Python. What exactly does not work?
--
http://mail.python.org/mailman/listinfo/python-list
=======================
file: z.scr
----------
#!/bin/bash
cd /opt/openoffice.org2.0/program
soffice "-accept=socket,host=localhost,port=2002;urp;" &
sleep 9
./python ./zhw.py
echo "Did this Run?"
# end of file
---------
file: zhw.py
---------
import uno
# get the uno component context from the PyUNO runtime
localContext = uno.getComponentContext()
# create the UnoUrlResolver
resolver =
localContext.ServiceManager.createInstanceWithContext("com.sun.star.b
ridge.UnoUrlResolver", localContext )
# connect to the running office
ctx =
resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.Compo
nentContext" )
smgr = ctx.ServiceManager
# get the central desktop object
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
# access the current writer document
model = desktop.getCurrentComponent()
# access the document's text property
text = model.Text
# create a cursor
cursor = text.createTextCursor()
# insert the text into the document
text.insertString( cursor, "Hello World", 0 )
# Do a nasty thing before exiting the python process. In case the
# last call is a oneway call (e.g. see idl-spec of insertString),
# it must be forced out of the remote-bridge caches before python
# exits the process. Otherwise, the oneway call may or may not reach
# the target object.
# I do this here by calling a cheap synchronous call (getPropertyValue).
ctx.ServiceManager
# end of file
------------
file: results
-----------
SysOp(P):> sh z.scr
Traceback (most recent call last):
File "./zhw.py", line 20, in ?
text = model.Text
AttributeError: Text
Did this Run?
SysOp(P):> =============NO!!!!!!
-----------------------
Haven't found any specific to scalc.
The zhw contents is closest to working I have found to date.
The z script was used to get to stated place and minimize typos.
As results shows - I ran as root. As user it screams lots. (Permissions)
The above is best effort so far. Others before it were even worse.
If you have working code I would like to tryout your linkage (process).
Before you send anything, can you use python to have scalc open a .xls
and save it as a csv? I can get python to have scalc open a specific
file and then point'n'click myself, but that isn't productive. I cannot
get scalc to do a saveas instruction issued by a python program. I have
no intentions of staying up all night pointing and clicking. Humans
think, computers do the repetitive. Yes? Besides, it is far easier to
train the computer than to train the ..... :)
Any help is appreciated.
Steve
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list