Vocola Information Pages   by Rick Mohr   (last modified February 24, 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
 

Keystroke Commands

Keystroke Commands Most of the everyday commands you will need are simple -- "When I say this, send these keystrokes." For example, the following command types the word "Greetings" when you say "Hello World":
 
 Vocola: Hello World = Greetings; 
 Say: Hello World Sent: Greetings 

In most cases the keystrokes you want to send will use modifier key sequences to control a particular application. For example, most Windows applications perform a "Copy" operation when you hold down the "Control" key and type the letter "c". The next command uses the phrase "Copy That" to invoke such a "Copy" operation:
 
 Vocola: Copy That = {Ctrl+c}; 
 Say: Copy That Sent: {Ctrl+c}

The Vocola syntax for specifying modifier key sequences such as {Ctrl+c} is borrowed from the Dragon Macro Language, which describes the syntax.
 
Each Vocola command contains a series of terms (indicating what is said) and a series of actions (indicating what is done), separated by "=" and terminated by ";". In this section the terms are words and the actions are keystrokes; later sections introduce other possibilities.

Because Windows applications allow keyboard control of almost everything, you can usually write a keystroke command to do what you want. The next example tells the Netscape mail program to use its HTML editor (rather than the plain text editor) for composing messages:
 
 Vocola: HTML Editor = "{Alt+e}e{Shift+Tab}{Down 8}{Tab}{Up}{Enter}"; 
 Say: HTML Editor Sent: {Alt+e}e{Shift+Tab}{Down 8}{Tab}{Up}{Enter}

Here's how it works:
 
 {Alt+e}Open the "Edit" menu

eChoose the "Preferences..." menu item, raising the Preferences panel

{Shift+Tab} Move back one field in the panel, to the "Category" list

{Down 8}Move down 8 lines, to the "Formatting" category

{Tab}Move forward one field in the panel, to "Message formatting"

uChoose the top radio button ("Use the HTML editor to compose messages")

{Enter}Hit the "OK" button

Quotation Marks and Whitespace

Quotation marks are optional around keystroke sequences. For example, the following commands are equivalent, specifying one action (the keystroke sequence {Ctrl+a}{Ctrl+c}):
Copy All = {Ctrl+a}{Ctrl+c};
Copy All = "{Ctrl+a}{Ctrl+c}";
Copy All = '{Ctrl+a}{Ctrl+c}';

Whitespace (any sequence of blank, tab, and newline characters) is used to separate actions. The following commands are also equivalent, specifying two actions (the keystroke sequence {Ctrl+a} followed by the keystroke sequence {Ctrl+c}):

Copy All = {Ctrl+a} {Ctrl+c};
Copy All = {Ctrl+a}
           {Ctrl+c};

In general it does no harm to separate keystroke sequences into multiple actions, so you can add whitespace wherever it is useful in formatting your commands. However, watch out for keystroke sequences containing space characters, such as the "HTML Editor" command above. That command specifies one action:

HTML Editor = "{Alt+e}e{Shift+Tab}{Down 8}{Tab}{Up}{Enter}";

Because this command contains a space character, omitting the quotation marks would unintentionally specify two actions, "{Alt+e}e{Shift+Tab}{Down" followed by "8}{Tab}{Up}{Enter}". This command would not behave as intended.

One alternative to quotation marks in this example is using the syntax "{Down_8}" instead of "{Down 8}":

HTML Editor = {Alt+e}e{Shift+Tab}{Down_8}{Tab}{Up}{Enter};

This is a Vocola extension to the Dragon Macro Language keystroke syntax -- within braces, underscore may be used instead of space to separate the keystroke name from the repetition count.

The examples in this tutorial use quotation marks only where necessary; you might prefer to use them more consistently. 

This page is (c) Copyright 2002 by Rick Mohr, and was last modified on February 24, 2002.