Vocola Information Pages by Rick Mohr (last modified January 13, 2002) |
Using AlternativesFor example, you might want to be able to say either "Switch View" or "Next
View" to switch between views in an application:
Here the alternative term (Switch | Next) allows you to say either. In many cases you want the actions invoked by a command to depend on which
alternative was spoken. For example, you might want to move the cursor in
one of four directions by saying "Move Left", "Move Down", etc.:
Here the reference "$1" specifies that the first variable term
should be substituted. So, when you say "Move Left" the value of the first
variable term is "Left" and the keystrokes "{Left}" are sent.
Often you will want to specify a range of numbers as alternatives in a
command. This can be specified concisely in Vocola, as in the following
example:
Here the syntax "1..10" is shorthand for "(1|2|3|4|5|6|7|8|9|10) ". On the right hand side we substitute the spoken number (e.g. "6 ") to construct the syntax for a repeated keystroke ("{Down 6}") and we have a command which moves the cursor down a specified number of lines. In real life it's very useful to control the arrow keys by saying simply
"1 Down", "3 Left", "6 Up", etc. Here's how to write it in Vocola:
This command has two variable terms. On the right-hand side the second
term (which direction to move) is substituted first and the first term (how
many times) is substituted second, to create the necessary keystroke syntax.
This page is (c) Copyright 2002 by Rick Mohr, and was last modified on January 13, 2002. |