Code is taken from a mail from Darragh Sherwin on dev@api.openoffice.org
# Connection Details to connect
# over an InterProcess Communication (IPC)
# pipe to the running OpenOffice process
def connect():
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", localContext )
remoteContext = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
return remoteContext
if __name__=="__main__":
remoteContext = connect()