Can Xray be used in a Python script?

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

See 5.1: http://berma.pagesperso-orange.fr/Files_en/XrayTool60_en.odt

It’s better MRI: MRI - UNO Object Inspection Tool | Apache OpenOffice Extensions

Work fine in LibreOffice, and you call into Python scripts…

Best regards

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.