Include Statements
Built-in Functions
Sometimes you will want to use a set of Vocola definitions in more than one application.
The Vocola "include" statement allows you to put such shared definitions
in a single file, and include that file in each of several application-specific
command files.
For example, many applications need to navigate the file system to find specific
files or folders. But speaking pathnames can be difficult, as can navigating
through folder hierarchies by voice. What you'd really like to do is define
a single list of shortcuts to interesting folders, and have that list available
in any program which needs to navigate the file system.
I've created a file called "folders.vch" ("vch" stands
for "Vocola header") to contain my personal list of interesting folders,
defined as a Vocola variable:
From file folders.vch:
<folder> := ( Home = C:\Rick | Temp = C:\Temp | Downloads = C:\Programs\Downloads | Start Menu ="C:\Documents and Settings\Rick Mohr\Start Menu" | Vocola = C:\Programs\NatLink\Vocola | NatLink = C:\Programs\NatLink\MacroSystem ); |
With the Vocola "include" statement this list can be used in several
Vocola command files. Here's part of my command file for Windows Explorer:
From file explorer.vcl:
include folders.vch;
Folder <folder> = {Alt+d} $1 {Enter}{Tab_2}; |
So for example, saying "Folder NatLink" to Windows Explorer switches
to the folder "C:\Programs\NatLink\MacroSystem".
The folder list is also useful in a Command Prompt (DOS box), where saying
for example "Folder Temp" performs the command "cd C:\Temp":
From file ntvdm.vcl:
include folders.vch;
Folder <folder> = "cd $1{Enter}"; |
Last and perhaps most useful is the following global command to move quickly
to a specific folder in a "File Open" dialog box:
From file _vocola.vcl:
include folders.vch;
Open | New | Save | File | Attachment | Browse | Directory:
Folder <folder> = $1\{Enter};
|
This global contextual command is active when the window title of any application
contains one of the words shown. For example, when saving an attachment in Microsoft
Outlook the window title is "Save Attachment", so saying "Folder
Temp" switches the dialog's current folder to "C:\Temp".
Include using a variable filename
The "include" statement's filename can be varied using references
to environment variables. For example, you might have a different set of interesting
folders at home than at work, and so want to include a different file depending
on which machine you are currently using. Since the environment variable "COMPUTERNAME"
contains the name of your machine, you could say:
include folders_$COMPUTERNAME.vch;
If your work machine were called "Venus" and your home machine were
called "family", you would define your list of interesting folders
in two separate files, "folders_Venus.vch" and "folders_family.vch".
|