Ask Your Question
1

Can Xray be used in a Python script?

asked 2017-05-29 17:59:51 +0200

peterwt gravatar image

Is it possible to call Xray from within a Python script and if so how is it done?

edit retag flag offensive close merge delete

Comments

EasyTrieve gravatar imageEasyTrieve ( 2017-05-30 23:44:54 +0200 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2017-05-29 18:04:34 +0200

mauricio gravatar image

It's better MRI: https://extensions.openoffice.org/en/...

Work fine in LibreOffice, and you call into Python scripts... https://github.com/hanya/MRI/wiki/Run...

Best regards

edit flag offensive delete link more
0

answered 2017-05-29 21:10:37 +0200

Ratslinger gravatar image

updated 2017-05-30 02:37:04 +0200

This works for Xray:

# Xray python script 
import uno
def xray_test():
    ctx = uno.getComponentContext()
    smgr = ctx.ServiceManager
    document = XSCRIPTCONTEXT.getDocument()
    xray(smgr,ctx, document)

def xray(smgr, ctx, target):
    mspf = smgr.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", ctx)
    script_provider = mspf.createScriptProvider("")
    script = script_provider.getScript("vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&location=application")
    script.invoke((target,), (), ())

Edit: Corrected to include uno & smgr. Tested from user directory.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-05-29 17:59:51 +0200

Seen: 287 times

Last updated: May 30 '17