Vocola Information Pages   by Rick Mohr   (last modified January 13, 2002)

 Introduction
 Using Vocola
 Language Tutorial
    Keystroke Commands
    Using Alternatives
    Defining Variables
    Substituting Actions
    Function Calls
->     Optional Words
    Comments
    Contextual Commands
    Example File
 Download Vocola
 Install Vocola
 Converting DVC Files
 Troubleshooting
 Support
 Wish List
 My RSI Story
 

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 is (c) Copyright 2002 by Rick Mohr, and was last modified on January 13, 2002.