Bernard Marcelly wrote:
Hi again,
Some additional info.
Message du 2006-10-10 21:18:
Hi Jürgen,
Message du 2006-10-10 17:07:

out parameters working fine, you simply have to initialize the array and an array with the length of 0 is fine.


Yes, this is what I did in Javascript. And it does not work with a called Basic script.


Here is the same example in BeanShell:

import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XModel;
import com.sun.star.script.provider.XScriptProviderSupplier;
import com.sun.star.script.provider.XScriptProvider;

oDoc = XSCRIPTCONTEXT.getDocument();
xsps = UnoRuntime.queryInterface(XScriptProviderSupplier.class,oDoc);
scriptPro = xsps.getScriptProvider();
xsp =  UnoRuntime.queryInterface(XScriptProvider.class, scriptPro);
xscript = xsp.getScript("vnd.sun.star.script:Standard.Module2.show2?language=Basic&location=document");
args = new Object [1];
args[0] = "Hello";
short [ ] [ ] a;
Object [ ][ ] b;
xscript.invoke(args, a, b);

I can see the message "Hello".
But here at return of invoke, variable a and variable b are Null. Not even an array.

sorry Bernard, i was to fast with my last answer and that an array with lenth 0 would be ok. The out parameter has to be an initialized array of length 1 but the expected return value can be null.

See my changed BeanShell exmaple:

import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XModel;
import com.sun.star.script.provider.XScriptProviderSupplier;
import com.sun.star.script.provider.XScriptProvider;

oDoc = XSCRIPTCONTEXT.getDocument();
xsps = UnoRuntime.queryInterface(XScriptProviderSupplier.class,oDoc);
scriptPro = xsps.getScriptProvider();
xsp =  UnoRuntime.queryInterface(XScriptProvider.class, scriptPro);
xscript = xsp.getScript("vnd.sun.star.script:Standard.Module1.show2?language=Basic&location=document");
args = new Object [1];
args[0] = "Hello";
short[ ] [ ] a = new short[1][ ];
a[0]=null;
Object [ ][ ] b = new Object[1][ ];
b[0] = null;
xscript.invoke(args, a, b);

args[0] = b[0][0];
xscript.invoke(args, a, b);


Juergen


   Bernard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to