Utility Scripts contributed by the OpenOffice.org communityThis page contains downloads of utility scripts that have been contributed by the OpenOffice.org community. These scripts are intended to demonstrate how to write Java (or the dynamically-typed Beanshell) scripts for OpenOffice, with full access to both the OpenOffice.org API and the Java APIs. The scripts are for use with the Early Developer Release 0.3 of the Office Scripting Framework and all subsequent releases.Pre-requisites
General Installation Procedure
Available Scripts
Word CountAuthor: Duncan FosterAim: Provides a simple word count of the selected text. Language: BeanShell Pre-requisites: none Download: WordCount.zip (2Kb) Installation: no additional steps needed Description: Uses the OpenOffice API to get the selected text, and then uses Java's StringTokenizer (using the default delimiters) to obtain a word count. Displays the result in a simple Swing dialog. Issues: none Top CapitalisationAuthor: Duncan FosterAim: Converts the selected text from upper case to first letter upper case, rest lower case, to lower case. Language: BeanShell Pre-requisites: none Download: Capitalise.zip (2Kb) Installation: no additional steps needed Description: Uses the OpenOffice API to get the selected text (or makes a selection of the current word if no text selected), and then uses Java to change the case. Rotates from "THIS" -> "This" -> "this" -> "THIS". The script attempts to break up selected text into sentences using the Java StringTokenizer. The script also attempts to maintain the selection. Issues: The script fails to maintain the selection if two separate areas of text are selected. For example, if the first and last words of the previous sentence were selected, only one (undefined) would remain selected after the script has been run. Top Post to NewsgroupsAuthor: Neil MontgomeryAim: Facilitates the posting of an OpenOffice document to a newsgroup. Language: Java Pre-requisites: none Download: Newsgroup.zip (540Kb) Installation: no additional steps needed Description: The script will detect if a local installation of either Netscape or Mozilla has been used to subscribe to any newsgroups. These newsgroups will be listed for the user in a combo box. If no newsgroups are detected the user must supply the name of the newgroup and server. The user may also supply the reply-to address, subject and message body (in the comment text field). The user can also specify the format in which to send the attached document (the currently active document). If the document hasn't already been saved with a title, then the default name for the attachment(s) will be "Attachment.sxw" and/or "Attachment.html". Issues: none. Top Scripting Framework Issuezilla Query -> WriterAuthor: John RiceAim: Outputs the results of an Issuezilla query into the open Writer document. Language: BeanShell Pre-requisites: none Download: SFBugsQueryIssuezilla.zip (2Kb) Installation: The script sets a HTTP proxy on lines 43,44. The user will need to modify or remove these according to their local settings. The script also contains a certain amount of debug output which the user may want to remove. Description: The script uses Java to open a HTTP connection to the OpenOffice.org website, passing a URL for an Issuezilla query for Scripting Framework bugs. The script then writes summary information for each bug into the open Writer document. Issues: none. Top Scripting Framework Issuezilla Query -> CalcAuthor: John RiceAim: Outputs the results of an Issuezilla query into the open Calc document. Language: BeanShell Pre-requisites: none Download: SFBugsQueryIssuezillaCalc.zip (2Kb) Installation: The script sets a HTTP proxy on lines 25,26. The user will need to modify or remove these according to their local settings. Description: The script uses Java to open a HTTP connection to the OpenOffice.org website, passing a URL for an Issuezilla query for Scripting Framework bugs. The script then writes summary information for each bug into the open Calc document. Issues: none. Top Insert Copyright SymbolAuthor: Duncan FosterAim: Inserts a copyright symbol (or replaces the current selection with a copyright symbol). Language: Beanshell Pre-requisites: none Download: InsertC.zip (4Kb) Installation: No additional steps needed. Description: Inserts a copyright symbol (or replaces the current selection with a copyright symbol). Issues: None. Top Insert Trademark SymbolAuthor: Duncan FosterAim: Inserts a trademark symbol (or replaces the current selection with a trademark symbol). Language: Beanshell Pre-requisites: none Download: InsertTM.zip (4Kb) Installation: No additional steps needed. Description: Inserts a trademark symbol (or replaces the current selection with a trademark symbol). Issues: None. Top Insert Hidden Text
Author: Duncan Foster |

