home products about shopping cart
 
   

Call Toll Free:
866-778-0524

Testimonials

"I purchased a Sennheiser mic and a (necessary) adapter from Speech Recognition Solutions. Just wanted to say thank you for excellent service and nearly immediate delivery."

-Bob R.
Salt Lake City, UT

"I thoroughly recommend this company to anyone seeking excellent service, reasonable prices, prompt delivery and after sales care and attention. Thank you, Jon!"

-Julie
Melbourne, Australia

Read More ...


Basics of Building Commands Using Dragon NaturallySpeaking

Jon Wahrenberger, MD

[Please note: what follows is some very basic information on programming in Dragon NaturallySpeaking from a non-programmer! These brief instructions are intended only as a starting point. Users seeking advanced instructions are encouraged to read Larry Allen's book "Scripting for Dragon NaturallySpeaking 8", available either through Speech Recognition Solutions (go to book) or directly from Larry Allen at Softnet. ]

Introduction: Although Dragon NaturallySpeaking (DNS) leads to great efficiencies by allowing your spoken word to be rapidly turned into words on your computer screen, perhaps the greatest benefit of DNS arises from the use of "commands". Commands tend to be one of two types: 1) Text or graphic commands and 2) Advanced commands. Text and graphics commands are simple to build and result in multiple lines of text appearing when a single voice command is issued. The reader is referred to the DNS user manual for more information on this easily mastered command type.

Advanced commands, on the other hand, are a bit more complex and typically allow the user to accomplish more intricate navigation and computer control tasks. This brief tutorial aims to provide you with the basic tools and information necessary to create advanced commands using DNS.

Legacy Commands versus Advanced Scripting Commands

Current versions of DNS use a pared-down version of the "Visual Basic" programming language - termed "Advanced Scripting" within Dragon - to build commands. This language is highly supported in the DNS help menu. The main advantage to the advanced scripting language is that it can take advantage of the macro capability in some programs, particularly Microsoft Office.

Older versions of Dragon allowed command scripting using a type of command called a DVC command, now commonly called "Legacy Commands". These commands tend to be considerably faster than newer Advanced Scripting commands and can still be used in current Dragon versions. Although Advanced Scripting commands can be built in any new command window by selecting "Advanced Scripting" from the command type scroll down window, legacy or DVC commands can only be created by duplicating an existing DVC command and modifying it for a new use. In general, it is helpful to know how to build both command types.

  For more information on using Legacy or DVC commands, click here or on the image to the left to download the "Dragon NaturallySpeaking: Creating Voice Commands" guide, included with earlier versions of NaturallySpeaking

BASIC SCRIPTING COMMANDS

Basics of Constructing a New Command

New commands utilizing advanced scripting are started by choosing "Add New Command" from the Tools menu. The basic command creating window appears as follows:

Key Components of this window include the following:

"MyCommand Name" field: This represents the name of your command and is the means by which your command is "called up" by your spoken words.

"Description": This is an optional field in which you can type a description of the command.

"Group": All commands are saved in groups. By default new commands are saved in the category "User Defined", but you can define new groups simply by typing any other name in this field. Once you have typed a new name for a group, it will always appear in the scrolled list and can be assigned to future commands. Group names are useful in categorizing commands for future use, including exporting to share or move to another computer.

"Command Type": This is where you choose the type of command. The possibilities you may pick from the scrolling window are:

Text and Graphics: This is the default setting and simply requires that you type or paste material into the large input filed within the "Content" area. This area is labeled content only when in the Text and Graphics command type. 

Macro Recorder: This is used for commands that you can't create any other way and allows you to record a series of steps which the program will record and, in essence, repeat when the command is called up.

Step-by-Step: This is another somewhat slow but simplistic method of program in which lines comprising a command are recorded step by step.

Advanced Scripting: This is the preferred method of programming a script using a modified form of the Visual Basic programming language and is described below. All user enter program is entered between the lines "Sub Main" and "End Sub" 

Creating a Text or Graphic Command:

Text commands are extremely useful time-savers and allow you to insert large blocks of text, including some formatting, by simply initiating (speaking) the command. This is useful for commonly used items and the command can call up anything from a few words to long passages of text, graphics and combinations of both.

Creating text commands is simple. These commands can be creating by saying "new command" or by launching the new commands wizard either directly through the tools window (Tools > Add New Command) or by opening the Command Browser and then Script > New. Either way you are presenting with the window shown above called the "MyCommands Editor.

The minimum you must do to create the command is give it a name by typing something into the MyCommand Name field, and adding something to the large "Content" window. Material can be added to this window by hand typing, by speaking (using Dragon to do the "typing", or by pasting material into the window. Once it's saved, when you say the command, the material (text or graphic) in the content section of the editor will get inserted into your document.

A few caveats on text commands:

1. Unless you click the "plain text" box on the bottom right of the MyCommands Editor window when creating the command, the command will always enter text with the size, font and style which was originally entered into the window. Maintaining formatting is useful if you want to include specific formatting in the text to be inserted.

2. If you click the "plain text" box, the inserted text will assume the font and size of the surrounding text already within the document into which it is being inserted.

3. Only some types of formatting are retained in material placed in a text and graphics command. Font style, size and formatting is reliably retained. Other aspects of formatting such as tabs, alignment and components of tables may not be retained.

4. In my experience, text placed within a document via a text command tends to be inserted adjacent to prior text without usual spacing following period. So if the text to be inserted is a complete sentence, you may need to add an additional two spaces in the command itself.

Creating a New Advanced Scripting Command:

A new Advanced Scripting command is created simply by choosing "Add New Command" from the tools menu, selecting a name for the command, choosing "Advanced Scripting" from the Command Type menu and adding appropriate programming between the "Sub Main" and "End Sub" portions of the scripting area. See below for details of scripting language.

An alternative to the above is to construct commands using Dragon's older scripting language, termed "Legacy Commands" or "DVC Commands". In order to do so, you must have an existing DVC command, such as the one listed below. [Need an existing DVC Command? Click here to download a basic DVD command to serve as a template for all others and save this somewhere and later inport the file into Dragon via the Command Browser] This must be opened using the "command browser" and then copied by clicking on the "Create New" button. Notice that this command editor does not have a scrolling choice of command type and the script content area is already labeled "DVC Script".

Once created, this new command should be renamed, described, placed in the group of your choice, and then the programming added in the "DVC Script" area. The new command is created simply by clicking on the "Create New" button on the bottom of the window.

The language used for DVC scripting is very similar to that used in Advanced Scripting with a few exceptions:

1. It is not necessary to have the "Sub Main" and "End Sub"

2. Modifier keys, such as "Ctrl", "Alt" and "Shift" must be typed out and in brackets, rather than in the shortcut form which can be used in Advanced Scripting (i.e. ^, %, and + respectively)

For more information on using Legacy or DVC commands, click here to download the "Dragon NaturallySpeaking: Creating Voice Commands guide", included with earlier versions of NaturallySpeaking

COMMAND SCRIPTING OPTIONS

Commands are available in DNS to accomplish a variety of tasks on your computer, including sending text, controlling aspects of Dragon, initiating tasks including copying and pasting text, printing documents, and lots, lots more.

Text Entry Controls:

[Note: In describing these scripting controls I will often put explanations of what a command line accomplishes, preceded by a single character quote. Such lines can be placed in commands and are ignored by the program]

SendKeys: Most basic command which sends keystrokes to the currently active window. It conforms to Visual Basic conventions. The SendKeys command can send no more than 250 characters. In general, if lots of text is to be sent, this is better done with a "text and graphic" type of command rather than with an Advanced Scripting command. If sending lots of text is necessary as part of a more complex command, this can be accomplished either by sending multiple SendKeys lines within the command or by using a "HeardWord" command which calls up a Text and Graphic command which contains the needed text.

Examples:

SendKeys "More than 50% of this visit was spent in direct patient counseling."

SendKeys "^c" 'Advanced scripting format sending command to copy text to clipboard)

SendKeys "{ctrl+c} (same command as above in Legacy Command format)

Another Example (this is a script that sequentially opens WordPad, inserts text from a text command called "Cath Risk", and then prints the document through the computer's default printer.)

AppBringUp "WordPad" 'Opens WordPad

HeardWord "Cath", "Risk" 'Initiates text command called "Cath Risk"

SendKeys "{ctrl+a}" 'selects all)

SendKeys "{ctrl+c}" 'copies all to clipboard

SendKeys "{ctrl+p}" 'initiates print document command with WordPad

Wait 0.5 'initiates half second wait

Sendkeys "{enter}" 'Hits enter key

A command to send a keystroke can be repeated multiple times by following the key with a space and a numeral indicating the number of repetitions and enclosing the entirely in brackets, i.e. SendKeys "{Right 3}"

By placing a comma and numeral 1 following a SendKeys command, then execution of the macro will be paused until the keys are sent.

SendSystemKeys: Slower than "SendKeys", this sometimes works when SendKeys does not. It tends to send one character at a time and is therefore slower than the SendKeys command. It should only be used if the command doesn't work with the SendKeys command.

Application Control:

AppBringUp: This control either starts (or if already started makes active) an application.

AppBringUp "WordPad"

AppSwapWith: This control switches the currently active application with another specified application.

Example:

AppSwapWith "WordPad"

ClearDesktop: This has the effect of minimizing all active applications.

ButtonClick: This causes the specified mouse button to be clicked at the current mouse location. The command can generate either a single or double click.

ButtonClick 1 -- clicks left button once

ButtonClick 1, 2 - clicks the left button twice

ButtonClick 2 - clicks the right button once

ButtonClick 2,2 - clicks the right button twice

MenuPick: Although most application menus can be initiated with a shortcut key defined by an underlined letter in the menu name, combined with the Alt key (i.e. File menu typically called up with Alt+F), for the occasional application that does not have such a capability, MenuPick is available to do the same thing.

Example: (A script to save a word processing document)

MenuPick "File"
Wait 1
MenuPick "Save As"

Dragon NaturallySpeaking Control:

GoToSleep: Puts Dragon in the sleep mode

WakeUp: Causes Dragon to exit the sleep mode and resume normal recognition.

SetMicrophone: This command turns the microphone on or off. It is often useful to turn the microphone off at the onset of a complex command to be sure that DNS is not influenced by ambient noise while the command is being run. Typically, the microphone will be turned on again at the end of the command. The two parameters for this command are as follows:

SetMicrophone 0 -- turns microphone off

SetMicrophone 1 -- turns microphone on

HeardWord: Emulates another Dragon command. Requires that you put each word of command in quotations, separated by commas.

Examples:

HeardWord "Delete", "All"

HeardWord "Open", "WordPad"

It is essential that each word be capitalized or not depending on what Dragon is expecting. In order to determine this, you should manually initiate the command and then see how Dragon handled caps by looking at the "View Recognition History" under the Dragon "Words" menu.

Wait: this builds in a set wait period in a command, often necessary to allow completion of one aspect of the command before moving on to next aspect. The convention for this statement is different in Advanced Scripting and Legacy commands.

Text to Speech Control:

TTSPlayString: This commands requests an audible response using synthesized speech. The actual speech to be synthesized must be placed in quotes. There is virtually no limit to what can be placed here, although you may not be happy with the synthesized pronunciation of some words. Placing a question mark within a statement will actually cause a slight increase in pitch at the end of the sentence, simulating the pitch change used in everyday language.

Example:

TTSPlayString "Command Completed"

TTSPlayString "Would you like to try that again?"

An alternative to the TTSPlayString command is the PlaySound command (see below).

Sound Control:

PlaySound: This command asks DNS to play a .wav file on your computer. In order to do so, the command must include a detailed location of the file and the file name. The entire pathway must be in quotes.

Example:

PlaySound "C:\Documents and Settings\Jon\My Documents\Voice\Sounds\transporter2.wav"

Beep: This is a simply command that simply plays the Windows "beep" sound. The beep command can be followed by a number indicating the number of beeps to occur, i.e. beep 2 or beep 5. Although I have never used this command, it is designed for use in signaling the user.

Miscellaneous Commands:

Wait: This command leads to a brief pause in a command, which is often useful to allow completion of one aspect of the command before continuing to the next step. The terminology is different in Advanced Scripting commands and DVC commands. In advanced scripting each unit of wait is equivalent to 1 second, whereas in DVC scripting each unit of wait is equivalent to a millisecond (1/1000 of a second) wait..

Example:

Advanced scripting: Wait 1 = 1 second wait

Wait 0.5 = second wait

DVC Scripting: Wait 1000 = 1 second wait

Wait 500 = second wait

Command Structure Principles:

1. Most scripting code most be placed in quotes,

SendKeys "^a"

SendKeys "Elect President Roosevelt."

2. All functions (non-text) must be enclosed in brackets, with the only exception being "modifier" keys used in advanced scripting commands.

SendKeys "{end}"

SendKeys "{alt+tab}

3. Modifiers key shortcuts do not need to be enclosed in brackets.

Sendkeys "^a^c"

4. Do not include spaces names of modifier keys pressed simultaneously, i.e.

5. Comments can be placed in commands after single character quotes and will be ignored as command progresses.

Example: SendKeys "^a" 'initiate select all

Modifier Key Shortcuts: These shortcuts can be used in Advanced Scripting commands but not Legacy Commands. Legacy commands must use the standard {ctrl}, {alt}, and {shift} format, along with a "+" key.

Advanced Scripting Format Legacy Format

^ {ctrl}

% {alt}

+ {shift}

^v {ctrl+v}

Navigation Commands: These commands move the curser within a word processing document.

Beginning of document: Control + Home

End of document: Control + End

Beginning of line: Home

End of line: End

Move Right one word: Control + Right

Move Right two word: Control + {Right 2}

Move left one word: Control + Left

Move left one letter: Left

Move left two letters Left 2

Move up one line: Up

Move down one line: Down

Text Selection Commands: These commands select text in a word processing document from the current curser position to another position based on the specific command sequence.

Beginning of document: Shift + Control + Home

End of document: Shift + Control + End

Beginning of Line: Shift + Home

End of Line: Shift + End

Move one word right: Shift + Control + Right

Move one word left: Shift + Control + Left

Move right one letter: Shift + Right

Move left one letter: Shift + Left

USING COMMANDS WITH LISTS (to come)

 

COMMAND EXAMPLES: (to come)

 

APPENDICES:

Decimal to ASCII Chart (not all of these work, but many do): (obtained from http://www.jimprice.com/ascii-0-127.gif


Speech Recognition
Solutions
offers low cost option for SR microphones and accessories. Learn more...


- Knowbrainer Forum
- Nuance Forum

- Speech Comp Forum
- Speech Rec Wiki
- VoiceRec.Com Forum
- Misc. Speech Links




We ship internationally and can do so at a very reasonable cost. Learn more ...
  home · products · free resources · about us · privacy · links · contact