|
|
User Guide for the Office Scripting FrameworkContentsPre-requisitesBefore you install the Scripting Framework, be aware of the following:
Binding Office ScriptsThe execution of Office scripts can be bound to menu and key items and also to application or document events. These bindings can be defined via a set of Assign dialogs which can be started from the Tools/Scripting Add-on's menu Assigning scripts to Menu and Key items The dialog shown below is the Assign Script to Menu dialog. This dialog is similar in design and function to the Assign Script to Key dialog and the instructions below should be seen to apply also to the Assign Script to Key dialog.
Note: Unlike StarBasic it will not be possible to setup a key binding that applies for the whole Office suite – key bindings can only be setup for an application or a document of that application type. Assigning scripts to events
Other Scripting-Add'ons Menu Items Two other menu items are available under the Tools/Scripting Add-on's submenu:
Running the example Office ScriptsThere are two examples scripts supplied with the Scripting Framework, Highlight and MemoryUsage. Highlight is an application level script for Writer that allows the user to search for a word or phrase. It will highlight all instances in red and give a count of the number of instances. The second example, MemoryUsage, is a script stored in a Calc spreadsheet that checks the current memory usage in the Java Virtual Machine and updates cells in the spreadsheet with the usage values. The spreadsheet also contains a graph which will update when the cell values are changed. The examples are available for both Java and BeanShell in the language directories created under <Office Installation>/user/Scripts by the installer. Running the Highlight example To run this example you first need to create a menu item from which you can execute the script.
Running the MemoryUsage example The Java version of the MemoryUsage example is already deployed inside an Office document, ExampleSpreadSheet.sxc. To run the Java example, just open: <Office Installation>/user/Scripts/java/ExampleSpreadSheet.sxc. You can then execute the MemoryUsage script by pressing CTRL+Shift+M with the ExampleSpreadSheet.sxc window focused. You should see the memory usage values being updated, and the graph should change to reflect the new values. Leveraging StarBasic SecurityAs part of the Early Developer Release
v0.2 of the Scripting Framework, we have attempted to mimic the
Security settings for StarBasic. The settings allow the user to
control the execution of macros present in OpenOffice.org documents.
Found in the Tools->Options dialog under
OpenOffice.org->Security, these settings allow the user
to specify the conditions under which it is permissable to execute
document based StarBasic macros. The settings in this dialog now
apply to both StarBasic macros and Scripting Framework scripts.
Different behaviour in the Scripting FrameworkThe Script Security has one significant difference in behaviour to
the StarBasic security. In the Scripting Framework the security
warning dialogs are displayed only upon the first script invocation
on a document containing scripts, unlike StarBasic where the dialogs
are displayed on loading a document containing macros. TroubleshootingSee the Release Notes page. Last Modified: Tue Mar 12 11:40:28 GMT 2003 |




