Coding Commands in Dragon Naturally Speaking

Is your information system a sad, slopped-together, user-hostile POS? Do not despair. You can mitigate interface issues using Dragon Naturally Speaking’s advanced scripting option.

Read on to discover how you can create custom commands to work around bad information system design, increase efficiency, reduce errors, and go home earlier.

Creating a Scripted Command

  1. Open Dragon and your user profile.
  2. Open Command Browser by saying “open command browser”. The lay out of your Command Browser will vary depending on your Dragon version.
  3. In the Command Browser window, click Browse Mode
  4. Click New
  5. Name the new command.
  6. Select “advanced scripting” as the command type. A coding window will open in the Command Browser.
  7. Add commands into the coding window between “sub main” and “end sub”.

Command Types and Formats

SendDragonKeys

SendDragonKeys: This command sends keystrokes to the active window. Enclose the names of nonprinting keys in brackets ({ }). Printed keys can be enclosed in brackets or between quotes. This command reliably sends a string of up to three printed keys, such as digits or letters. To specify a shift-key combination, enclose the modifier key name (such as Alt), a plus sign (+), and the shifted key in braces. To repeat a keystroke or key combination, enclose the key name, a space, and the number of repetitions in brackets. Enclose the entire command phrase in quotation marks (“).

Format:  SendDragonKeys “{Key+Key Number of repeats}”

Example: SendDragonKeys “{Ctrl+Right 3}” sends the control and right key simultaneously, three times.

Example: Both SendDragonKeys “{2 2}” (2 sent 2 times) and SendDragonKeys “22” will both produce 22 as text.

Key names for SendDragonKeys

This table available on the Dragon Website lists the names of nonprinting keys and the codes to use with the SendDragonKeys command. A simplified list follows.

Key Key Code
ALT {Alt}
BACKSPACE {BackSpace}
BREAK {Break}
CAPS LOCK {CapsLock}
   
CONTROL {Ctrl}
DEL {Del}
DOWN ARROW {Down}
END {End}
ENTER {Enter}
ESC {Esc}
HELP {F1}
HOME {Home}
INS {Ins}
LEFT ARROW {Left}
   
PAGE DOWN {PgDn}
PAGE UP {PgUp}
PAUSE {Pause}
PRINT SCREEN {Prtsc}
RIGHT ARROW {Right}
SCROLL LOCK {ScrollLock}
SHIFT {Shift}
SPACE {Space}
   
TAB {Tab}
UP ARROW {Up}
F1, F2, F3,…F16 {F1}, {F2}, {F3},…{F16}

 

 

Additional Handy Commands

Select Above    {Shift+PgUp}
Select Below    {Shift+PgDn}
Select Right      {Shift+End}
Select Left        {Shift+Home}
Notes
    • Always precede the BREAK key with the CONTROL key.
    • If you need to specify one of two ALT, CTRL, or SHIFT keys, use {LeftAlt} or {RightAlt}, {LeftCtrl} or {RightCtrl}, and {LeftShift} or {RightShift}.
     

HeardWord

HeardWord: This command causes Dragon to behave as if it has “heard” a spoken command, word, or string of words. In the command, words to be “heard” are enclosed in quotes and   separated by commas.

Format: HeardWord “word”, “word,” …

Examples: The HeardWord command can be used to send commands and text. It can initiate a user command within a longer script. For instance, HeardWord “sing”, “vas” can be used to produce a standard report in the context of a longer string of commands that formats, then releases, and codes the standard report.

HeardWord “press”,”backspace” will send the cursor back one space.

HeardWord “this”, “text” will add the words – this text – to a document.

HeardWord is best for activating user-specific, text based commands such and “sing vas”. In some contexts, HeardWord provides an alternate to SendDragonKeys, a handy feature since sometimes, for no discernible reason, one command works better than the other.

 

 

 

Set Mouse Position

The set mouse position command moves the mouse to a point on the screen defined as defined by coordinates. If using double screens, know that the command references “screen 1”. So place the window to your information system in screen 1.

First define the coordinates of a useful location, for instance a button or icon on screen. Open MyCommands and click “new.” The MyCommands Editor will open. Name the coordinates of interest (“open case” or “close document” for example). Set the command type to “Macro Recorder”.
Now click “Record”.

The MyCommands window will disappear, and a small “Recorder” box will oven in the screen’s left lower corner. Every move of the mouse will now be recorded, so take the pointer to the area of interest and left click. Press the black rectangle on the Recorder to stop recording. Click X to close the recorder and return to MyCommands.

Button Click

The ButtonClick command generates a single or double click with the specified mouse button.

ButtonClick [button[, count]]

1 designates a left click. 2 designates a right click.

 

Example:

ButtonClick {1,2} produces a double click of the left mouse button.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top