Python: the second and third arguments of invoke()?
Posted: Wed Dec 23, 2015 1:05 am
I'm calling an external python function as follows. I know how to pass arguments to my python function via the first parameter passed to the invoke() call (in this case, the values "a", "b", and "c"), and I know that these become the arguments that are passed to the python function.
However, I have no idea how the second and third arguments to "invoke" are used when calling python (variables "secondArg" and "thirdArg" in my example). Is there a way to access these second and third arguments via the python function or perhaps for this python function to fill those arguments with return values?
Thank you in advance.
However, I have no idea how the second and third arguments to "invoke" are used when calling python (variables "secondArg" and "thirdArg" in my example). Is there a way to access these second and third arguments via the python function or perhaps for this python function to fill those arguments with return values?
Thank you in advance.
Code: Select all
Global g_MasterScriptProvider
Const URL_Main = "vnd.sun.star.script:"
Const URL_Args = "?language=Python&location=user"
Function getMasterScriptProvider()
if not isObject(g_MasterScriptProvider) then
s = "com.sun.star.script.provider.MasterScriptProviderFactory"
g_MasterScriptProvider = createUnoService(s).createScriptProvider("")
end if
getMasterScriptProvider = g_MasterScriptProvider
End Function
Function PythonFunction()
scriptName = "pyfunc"
fullURI = URL_Main & scriptName & ".py$" & scriptName & URL_Args
m = getMasterScriptProvider()
s = m.GetScript(fullURI)
secondArg = Array()
thirdArg = Array()
result = s.invoke(Array("a", "b", "c"), secondArg, thirdArg)
PythonFunction = result
End Function