Is it possible to display the script that was retrieved with getscript?

asked 2021-07-20 17:25:33 +0200

newskier10 gravatar image

So I was reading through the libreoffice article on executing python macros from basic. (https://help.libreoffice.org/6.4/en-U...) and understand how to invoke a macro with this code:

    Option Explicit

Public Function GetPythonScript(macro As String, _
        Optional location As String) As com.sun.star.script.provider.Xscript
    If IsMissing(location) Then location = "user"
    Dim mspf As Object ' com.sun.star.script.provider.MasterScriptProviderFactory'
    Dim sp As Object ' com.sun.star.script.provider.XScriptProvider compatible'
    Dim uri As String
    If location="document" Then
        sp = ThisComponent.getScriptProvider()
    Else
        mspf = CreateUNOService("com.sun.star.script.provider.MasterScriptProviderFactory")
        sp = mspf.createScriptProvider("")
    End If
    uri = "vnd.sun.star.script:"& macro &"?language=Python&location="& location
    GetPythonScript = sp.getScript(uri)
End Function ' GetPythonScript

Private scr As Object ' com.sun.star.script.provider.XScript

Private Property Get ComputerName As String
    '''Workstation name'''
    scr = GetPythonScript("Platform.py$computer_name", "document")
    ComputerName = scr.invoke(Array(), Array(), Array())
End Property ' ComputerName

And that all makes sense. My question is, is there some way to display the retrieved script? Something like scr.script or something? Is there any documentation that has the available properties and functions of the script object?

edit retag flag offensive close merge delete