Vocola Information Pages   by Rick Mohr (this page updated May 31, 2003)
 
 Introduction
 Using Vocola
 Language Tutorial
    Keystroke Commands
    Quotes And Whitespace
    Using Alternatives
    Defining Variables
    Substituting Actions
    Capturing Dictation
    Optional Words ->
    Function Calls
    Built-in Functions
    Defining Functions
    Contextual Commands
    Include Statements
    Comments
    Example File
 Command Sequences
 Install Vocola
 Vocola Versions
 Converting DVC Files
 Troubleshooting
 Support
 Wish List
 My RSI Story
 Voice Resources
 

Optional Words

Optional Words Sometimes you want to create a command with optional words. For example, you might want to be able to say either "Hit Start Menu" or just "Hit Start" to bring up the Windows Start Menu:
 
 Vocola: Hit Start [Menu] = SendSystemKeys( {Ctrl+Esc} ); 
 Say: Hit Start Menu  Sent: {Ctrl+Esc}
 Say: Hit Start       Sent: {Ctrl+Esc}

Enclosing the optional word "Menu" in square brackets does the trick.

Note that optional words are not considered variable terms. Consider this example:
 
 Vocola: [Move] Down 1..10 = {Down_$1}; 
 Say: Move Down 1  Sent: {Down 1}
 Say: Down 6       Sent: {Down 6}

Because the optional word "[Move]" is not considered variable, the range "1..10" is the first variable term and is referenced using "$1".
 
Note that a command must have at least one non-optional term.


This page (c) Copyright 2002-2005 by Rick Mohr.