Vocola Information Pages by Rick Mohr (last modified February 24, 2002) |
Keystroke Commands
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:
The Vocola syntax for specifying modifier key sequences such as {Ctrl+c}
is borrowed from the Dragon Macro Language, which describes the syntax.
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:
Here's how it works:
Quotation Marks and WhitespaceQuotation 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}; 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}; 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:
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}": 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. |