About‎ > ‎Announcements‎ > ‎

Command and Script Tokens

posted 20 Feb 2010, 20:11 by James Holgate   [ updated 11 Oct 2010, 12:15 ]

When you need these values in a command or a script use the appropriate token. When the add-on is executed, the value in brackets is replaced by the actual string required.

Current date as spoken in region (DATE)
Current day of week as spoken in region (WEEKDAY)
Current time as spoken in region (TIME)
Current time reformatted so that you can use it in a filename (NOW)
Full name of path and temporary file containing selected text (TMP)
Name of the author (AUTHOR)
Path of OpenOffice.org sound gallery (SOUND_GALLERY)
Work directory also known as My Documents or home (HOME)
Application language code – en for English; fr for French etc. (LANGUAGE_CODE)

Additional tokens are available in ReadText Extension 0.3.0:

URL encoded string of up to 9999 characters of the selected text (OOO_WEBTEXTBIG)
URL encoded string of up to 999 characters of selected text (OOO_WEBTEXT)
URL encoded string of up to 99 characters of selected text (OOO_WEBTEXTSMALL)

An additional token is available in ReadText Extension 0.4.1:

Path to a Windows Script to read using the system's voice (TTS_WSCRIPT_VBS)

Example 1

You want espeak to automatically switch language depending on the language of the application GUI

Select some text in OpenOffice.org.
Show the Read Selection dialog with Tools → Add-Ons → Read Selection...
Select Read the Selection with another program
Browse to the path to espeak
In the command box, enter -v (LANGUAGE_CODE) -f "(TMP)"
Click OK

Example 2

You want festival to create an audio file that shows the time you created it.

Select some text in OpenOffice.org.
Show the Read Selection dialog with Tools → Add-Ons → Read Selection...
Select Read the Selection with another program
Browse to the path to text2wave - in Ubuntu Linux, the location is /usr/bin/text2wave
In the command box, enter "(TMP)" -o "(HOME)ooo_festival_(NOW).wav"
Click OK to create a wave file in the OpenOffice.org document directory.

Note

Use the token substitutions in the add-on dialog fields. If you write a bash script, you can use tokens like $1 $2 and $3 in the script to accept command line parameters. See the record_french.sh script for an example.

Comments