Page 1 of 1

[Solved] Running a User Defined JAVA macro from BASIC macro

Posted: Sun Sep 29, 2013 2:03 pm
by ganesh17
I am new to writing macro for openoffice.

I had written a java macro. I have tested it seperately and it works correctly.
The JAVA macro is placed in C:\Program Files (x86)\OpenOffice 4\share\Scripts\java\CalledFromBasic folder and with the jar as CalledFromBasic.jar.

I am trying to call this from openoffice BASIC macro, for which the code is as follows.

Code: Select all

Sub Main

	MSPF = createUnoService("com.sun.star.script.provider.MasterScriptProviderFactory")
	scriptPro = MSPF.createScriptProvider("")
	xScript = scriptPro.getScript("vnd.sun.star.script:TestCallFromBasic.test?language=java&location=share\Scripts\java\CalledFromBasic")
	Thing = xScript.Invoke()

End Sub
I am getting unsatisfied query for interface of type com.sun.star.provider.XScriptProvider.
From http://www.openoffice.org/api/docs/comm ... #getScript I know that I need to give 2 parameters.
I'm not able to figure out how to call using getScript.
Can anyone help ?

Re: Running a User Defined JAVA macro from a BASIC macro

Posted: Thu Oct 03, 2013 11:54 am
by hanya
Hi, welcome to the forum.

You are using wrong URI to your Java macro. It should be something like:

Code: Select all

vnd.sun.star.script:CalledFromBasic.TestCallFromBasic.test?language=Java&location=share

Re: Running a User Defined JAVA macro from a BASIC macro

Posted: Wed Oct 09, 2013 4:08 pm
by ganesh17
I am testing that .
Thank you