Skip to content

start:

Developing Scripts on the Command Line

For users who do not wish to develop their Office Scripts using an IDE there is a simple command line interface built into the Office Scripting module which can be used for the generation and deployment of Office Scripts.

Contents

Prerequisites

The CommandLineTools class

The CommandLineTools class takes the following options (Note: Options in angle brackets "<>" are required, options in square brackets "[]" are optional):
-g [Path to Parcel directory] [options]

Generates a Script Parcel for the given the parcel directory. The parcel name will be the name of the parcel directory plus the .sxp extension.

-d <Path to Script Parcel> <Target Directory|Document>

Deploys the given Script Parcel to a directory or an OpenOffice.org document. A directory will be created with the name of the Parcel and the contents of the Parcel will be put into that directory.

  • If deploying to an OpenOffice.org installation the target directory should be the <Office Installation>/user/Scripts or <Office Installation>/share/Scripts directory. If the either the Script Parcel or the target do not exist an error message is printed. Otherwise the Script Parcel is deployed to the target.

Top

Examples

  • java CommandLineTools -g myparceldir -l Java

    Generates a myparceldir.sxp file in myparceldir automatically exporting all public Java methods which take XScriptContext as their first parameter as Office scripts.

  • java CommandLineTools -g -l BeanShell=.bsh

    Generates a script parcel file in the current directory automatically exporting all files that end with the .bsh extension as BeanShell scripts

  • java CommandLineTools -g myparceldir -l BeanShell MyScript.bsh

    Generates a myparceldir.sxp file in myparceldir and exports MyScript.bsh as an Office script.

  • java CommandLineTools -g myparceldir -l Java -p classpath=dep1.jar:dep2.jar

    Generates a myparceldir.sxp file in myparceldir, automatically searching for valid Office scripts, and adding the classpath property to each Office script.

  • java CommandLineTools -g myparceldir -l Java -p classpath=dep1.jar:dep2.jar -p secondprop=secondvalue

    Generates a myparceldir.sxp file in myparceldir, automatically searching for valid Office scripts, and adding the classpath and the secondprop properties to each Office script.

  • java CommandLineTools -d myparceldir.sxp /export/home/MyOffice/user/Scripts

    Deploys the myparceldir.sxp Script Parcel to the specified office directory.

Top


Last Modified: Tue Mar 12 11:40:28 GMT 2003