Apache OpenOffice (AOO) Bugzilla – Issue 10022
cannot execute script saved to a file
Last modified: 2003-02-24 15:55:50 UTC
OpenOffice.org 643C, Srcipting framework early developer release, version 0.1. This bug is described in two parts, firt user deploys a script to the user application area, creates a binding and then removes the script. The user then deploys a new script with the same name as the original to a document, the previouslky created key binding should cause the script deployed to the document to execute. Part 1. 1. Start jedit Browse to Utilities>Global Options... Browse in the Global Options dialog box to the Proxy Servers. Check "Use HTTP proxy Servers" and set all information needed for jEdit to access the web. Click on OK. 2. Browse to Plugins->Plugin Manager... Click on Install Plugins (If you get errors then your Proxy is not well setup) Then you get a list of plugins. The plugins needed for Scripting IDE are AntFarm and Console. So just select them if you cant find them on the list then you have them already installed. Click on install Just to make sure you have the latest AntFarm and Console click on Update Plugins Click on Close. Exit jEdit. 4. Start jEdit again. Browse to Utilities>Global Options... Select Plugins->Office Scripting Select the Path of your Office installation. Ensue you select Apply , select OK. 5. Select Plugins->AntFarm->Build Options Select Run Ant Targets in the same JVM. 6. Browse to Utilities>Global Options... Select Docking Activity Log docking position: bottom Ant Farm docking position: right Console docking position: bottom Error List docking position: bottom File System Browser docking position: left Office Scripting docking position: right Click on Apply, click onOK. 7. Click on the Office Scripting button on the right of the frame. Right click on all parcels. Select New Enter the name of the new parcel e.g. HelloJedit. Select a directory where you want the parcel to be built . 8. In the left hand frame the HelloJedit script is opened you need to add the following lines to the top of the script immediately after the first import statement import com.sun.star.uno.UnoRuntime; import com.sun.star.frame.XModel; import com.sun.star.text.*; 9. Add the following lines within the public class HelloJedit class. XModel model = xSc.getDocument(); XTextDocument textdoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, model); XText oText = textdoc.getText(); XTextCursor oCursor = oText.createTextCursor(); oText.insertString(oCursor, "Hello jEdit", false); 10. Right click on 'HelloJedit' and select ScriptCompile. After complation has successfully completed, right click on 'HelloJedit' and select Build Parcel SXP. In the scripting framework dialog that appears select all methods in the left frame and add to scripts (right frame). Select Finish. 11. Right click on the HelloJedit.sxp parcel and select Deploy to OpenOffice.org. Check that the scripts have been deployed to <office_installation>/user/Scripts/java. 12. Assign an event to execute the script. -Start OpenOffice.org writer document. - Select Tools, Assign Script(java) To, Menu. -In the popup dialog, in the select script function select a script e.g. HelloJedit.doMethod Select File in the Top Level menu drop down list. In the New Menu, enter a menu item name e.g. HelloJedit. Select New Script Menu, select ok. - Select OK when prompted to restart OpenOffice.org. Exit and restart OpenOffice.org writer document. - Select File, HelloJedit - Hello jEdit should be inserted into the document. Part 2. Delete directory <office-install>/user/Scripts/java/HelloJedit. OpenOffice.org is not running. A previously created OpenOffice.org writer document, e.g. TestBindjE.sxw 1. Start Jedit Click on the HelloJedit.java file listed under All Parcels, HelloJedit. Change the text in the hellojedit.java file from "Hello jEdit" to "Hello jEdit 3---". Select File Save. 2. Right click on hellojedit and select Script Compile. After complation has successfully completed, right click on 'HelloJedit' and select Build Parcel SXP. Select Finish. 3. Right click on the HelloJedit.sxp parcel and select Deploy to Document. 4. Check that the script has been successfully deployed to the document by running unzip -l TestBindjE.sxw. (Unix) or pkunzip -v TestBindjE.sxw (Windows). You should see the script saved in the document. 5. Launch OpenOffice.org, note the previously assigned bindings as setup in part 1 still apply to the TestBindjE.sxw document. Open the TestBindjE.sxw document. 6. Select File HelloJedit - "Hello jEdit 3--- "should be inserted into the document.
Step 6 does not execute, i.e. HellojEdit 3--- does not get inserted to the document.
Reassigning to John to find appropriate owner.
Reassign to Noel to be fixed. Issue is problem with IDE's adding "." in CLASSPATH when saving out parceldescriptor.xml. On loading script the framework works fine when loading from file, but ucb has a problem with the "." in the CLASSPATH and this stops correct loading of script. IDE's should not be adding "." and the SF should be eating the "." before making the ucb query.
Additional code added to new class PathUtils.java which processes ./ and ../ entries in path.
SFrameworkInstall.jar.02.21.2003 option added for assign to scripts within document. However the functioanlity of this option does not work as specified in 11726. closing issue.