-----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
>
> XScript: provides the invoke() method, which calls the macro and
> returns its return value.
>
> XScriptProvider: Which returns an XScript for a given script URI (e.g.
> vnd.sun.star.script:Tools.ModuleControls.getControlView?language=Basic&location=application)
>
> XScriptProviderSupplier: gets you a script provider. This interface is
> implemented by a TextDocument for instance.
>
> ATTENTION: Not every XScriptProvider can resolve every script URI! For
> instance the script provider returned by a TextDocument's
> XScriptProviderSupplier can't resolve script URIs for shared scripts
> such as the one I gave above. It can only resolve script URIs for
> scripts stored in the document.
> Note also that script URIs are not globally unique. The script tree
> can have multiple scripts with the same URI. This ambiguity is
> resolved by calling getScript() on the correct XScriptProvider.
>
> BrowseNode: service for traversing the script tree. If you want all
> scripts, start at
> com.sun.star.script.browse.theBrowseNodeFactory.createView(BrowseNodeFactoryViewTypes.ORGANIZER)
>
> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org
iD8DBQFDXPbmkVPeOFLgZFIRAmYpAKCYdvtkhZ1o4GosPYbLpnOEuA8IewCgorqA
H0dWeXnRhKcSsHZWfoHTjgM=
=RmzF
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]