How to deploy and invoke JavaScript in an extension`?

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
LuggeB
Posts: 3
Joined: Tue Jan 20, 2009 7:21 pm

How to deploy and invoke JavaScript in an extension`?

Post by LuggeB »

Hi everybody,

first of all sorry for the cross post. But perhaps my question is more appropriate for the Extension forum.

Perhaps you can help me out. I created a BASIC Macro and a JavaScript Macro, both working fine and interacting with each other in my development environment.

The BASIC script invokes the JavaScript by

Code: Select all

oMasterScriptProviderFactory = createUnoService("com.sun.star.script.provider.MasterScriptProviderFactory")
oMasterScriptProvider = oMasterScriptProviderFactory.createScriptProvider("")
oTranslate = oMasterScriptProvider.getScript("vnd.sun.star.script:GTPT.gtpt.js?language=JavaScript&location=user")
So I created a extension using the Extension Compiler and it worked fine. But it doesn't seem to deploy the JavaScript though it's contained in the myExtension.oxt.

The parcel-descriptor of the JavaScript is

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<parcel language="JavaScript" xmlns:parcel="scripting.dtd">
    <script language="JavaScript">
        <locale lang="en">
            <displayname value="gtpt.js"/>
            <description>gtpt.js</description>
        </locale>
        <logicalname value="gtpt.js"/>
        <functionname value="gtpt.js"/>
    </script>
</parcel>
The manifest.xml of the Extension contains

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
   <manifest:file-entry manifest:media-type="application/vnd.sun.star.package-bundle-description" manifest:full-path="Tooltips/tip-en.txt" />
   <manifest:file-entry manifest:media-type="application/vnd.sun.star.help" manifest:full-path="help" />
   <manifest:file-entry manifest:media-type="application/vnd.sun.star.basic-library" manifest:full-path="Basic/GTPT/" />
   <manifest:file-entry manifest:media-type="application/vnd.sun.star.framework-script" manifest:full-path="JavaScript/" />
   <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="AddonUI.xcu" />
</manifest:manifest>
After installing the extension I get a librabry named GTPT in "My Macros" but I cannot find the Javascript.
What is wrong? Is there a way to deploy the JavaScript in My Macros of Java Script Macros in the respective Macro Organizer.
How do I invoke the Javascript correctly?

Thanks a lot in advance.
Best regards,
Lugge
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: How to deploy and invoke JavaScript in an extension`?

Post by hanya »

Here is an example to install the macro created by the JavaScript and the Basic.
mytools_js.zip
Change the file extension to zip.
(3.48 KiB) Downloaded 344 times
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
Post Reply