But I think if you are calling a OOBasic-Macro e.g. from Java you need to invoke the ScriptingFramework don't you?
So maybe the snippet should deal with calling a Macro from some UNO-Binding e.g. C++, Java, Python, ... and fetching its return value. Tom > --- Ursprüngliche Nachricht --- > Von: "G. Jasper" <[EMAIL PROTECTED]> > An: dev@api.openoffice.org > Betreff: Re: [api-dev] Returnvalues from Macros > Datum: Mon, 24 Oct 2005 19:45:46 +0200 > > Tom Schindl wrote: > > >-----BEGIN PGP SIGNED MESSAGE----- > >Hash: SHA1 > > > >Matthias Benkmann wrote: > > > > > >>On 10/17/05, Alexander Peters <[EMAIL PROTECTED]> wrote: > >> > >> > >> > >>>Hello! > >>>I use OLE to connect to OpenOffice.org Writer and want to get > >>>Returncodes from Macros which i execute with a dispatcher. How can i > >>>make this? Or is there an other way to execute macros to get a > >>>returnvalue? Any Codesnip in any language will help me. > >>> > >>> > >>If you don't need compatibility with versions prior to 2.0, you can > >>use the Scripting Framework (Developer's Guide chapter 18). > >> > >>The involved services and interfaces are > >> > >>The following code demonstrates the SFW: > >> > >>Sub Main > >> doc = ThisComponent > >> scriptProvider = doc.getScriptProvider() > >> script = > scriptProvider.getScript("vnd.sun.star.script:Standard.Module1.Foo?language=Basic&location=document") > >> retval = script.invoke(Array("Hallo World"), Array(), Array()) > >> MsgBox(retval) > >>End Sub > >> > >>Function Foo(st as String) as String > >> MsgBox(st) > >> Foo = "Bye Bye" > >>End Function > >> > >> > >>Matthias > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >>This would be a great short code-snippet ;-) > >>Tom > >> > Tom, Matthias, Alexander, > > I suppose my example was too elaborate. The essence was in > calling the function, which returns a value, just as it does in > Matthias Benkmann's example. > But the code snippet can be much shorter, because you don't > need the scriptProvider at all: > > Sub shortMBNKMN > MsgBox Foo( "Hello World" ) > End Sub > > Function Foo(st as String) as String > MsgBox(st) > Foo = "Bye Bye" > End Function > > This gives exactly the same result. > > Sincerely, > Gerrit Jasper > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- 10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail +++ GMX - die erste Adresse für Mail, Message, More +++ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]