Quick Reference
Document Index

DNS Scripting Reference
Speech Recognition Reference
v.2.0
Relative to: NaturallySpeaking Versions 4.0 and above



Visual Basic References (versions 6.1 and above)

Essential Dragon/VB commands

Parameters (lists) and Variables

Flow Control

Advanced Dragon/VB commands

Dragon Scripting References (Legacy DVC commands - versions 6.0 and below)



NaturallySpeaking 6.1 and Higher VB Commands

Dragon Commands

Visual Basic Reference

Go to Top

VB: SendKeys Statement

  • Sends one or more keystrokes to the active window as if typed at the keyboard.
  • Syntax: SendKeys "string"[, wait]

The SendKeys statement syntax has these named arguments:

  • String expression (required) specifying the keystrokes to send
  • Wait (optional) Boolean value specifying the wait mode. If False (default), control is returned to the procedure immediately after the keys are sent. If True, keystrokes must be processed before control is returned to the procedure.

Remarks

To represent ABC abc 123 use "ABC abc 123" for "string".
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) are considered special characters. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}. Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. In other applications, brackets do have a special meaning that may be significant when dynamic data exchange  (DDE) occurs. To specify brace characters, use {{} and {}}.
To specify non printing keys such as ENTER or TAB, and function keys:
  • BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
  • BREAK {BREAK}
  • CAPS LOCK {CAPSLOCK}
  • DEL or DELETE {DELETE} or {DEL}
  • DOWN ARROW {DOWN}
  • END {END}
  • ENTER {ENTER} or ~
  • ESC {ESC}
  • HELP {HELP}
  • HOME {HOME}
  • INS or INSERT {INSERT} or {INS}
  • LEFT ARROW {LEFT}
  • NUM LOCK {NUMLOCK}
  • PAGE DOWN {PGDN}
  • PAGE UP {PGUP}
  • PRINT SCREEN {PRTSC}
  • RIGHT ARROW {RIGHT}
  • SCROLL LOCK {SCROLLLOCK}
  • TAB {TAB}
  • UP ARROW {UP}
  • F1-F16 {F1}-{F16}
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:
  • SHIFT = +
  • CTRL = ^
  • ALT = %
Combination Keys: To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example,  to hold down SHIFT while E and C are pressed, use "+(ec)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+ec".
Repeating Keys: To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 25} means press the LEFT ARROW key 25 times; {h 15} means press the H key 15 times.
Note: You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows. SendKeys also can not send the PRINT SCREEN key {PRTSC} to any application.


List Commands with SendKeys
using:
  • UtilityProvider.ContextValue(ValueIndex)
  • ListVarx
  
Examples for "Move  <Direction> <1to5>" command where <Direction> contains UP, DOWN, RIGHT, LEFT and <1to5> contains 1,2,3,4,5
  • UtilityProvider.ContextValue(ValueIndex) example
 UtilityProvider.ContextValue(ValueIndex) is a zero based index for parameter retrieval.

SendKeys "{"+UtilityProvider.ContextValue(0)+" "+UtilityProvider.ContextValue(1)+"}"
  • ListVarx example
ListVarx is a one based index for parameter retrieval.

SendKeys "{"+ListVar1+" "+ListVar2+"}"

Parameter Conversion
  • Val(S$) - Return the numeric value for this string value with appropriate data type.
  • CInt(Num/S$) - Convert number or string to a 16 bit integer.
  • CStr(Num/S$) - Convert number or string value to a string value

Convert Parameter to Number Value: NumVal = val(ListVar1)
Convert Number Value to text (CStr():  SendKeys "{Enter}{Up "+CStr(IntgrValue)+"}"
Convert Date to Text: SendKeys Str(Date)


Go to Top

VB: Wait Statement

  • Pauses execution of the program for the specified amount of time
  • Syntax: Wait seconds

The Wait statement syntax has these named arguments:

  • Seconds (required)  A Real number expressing the seconds and fractions of a second to wait.  A value of 3.2 would produce a 3.2 second pause, a value of 0.01 would produce a 1/100 second pause.

Remarks

none


VB: SendDragonKeys Statement
SendDragonKeys "Hello{Enter}"

  • Automatically created when upgrading DragonNaturallySpeaking 6.0 or scripting commands to 6.1 or higher.
  • operates the same as the Dragon legacy DVC SendKeys Command when used in Advanced Scripting commands
  • May work in some cases where SendKeys does not.


VB: SetMousePosition Statement
SetMousePosition 1, x, y

  • Places the mouse at the x (horizontal) and y (vertical) pixels relative to the top left corder of the active window.
  • Use trial and error to locate the correct values for x and y
SetMousePosition 1, 200, 500  Places the mouse 200 pixels from the left and 500 pixels from the top of the current window.


VB: ButtonClick Statement
ButtonClick [b, [n]]

b = button to click: 1 for Left Button (default), 2 for Right Button, 3 for Middle Button
n = number of clicks: 1 for single click (default), 2 for double click

  • Clicks the specified mouse button the specified number of times.
ButtonClick 1, 2  Double clicks the Left mouse button.



VB: AppActivate Statement
AppActivate Title$

  • Activates the window with a caption (title) that starts with Title$
  • Useful when "Switch to ___" failes to work.
AppActivate "Microsoft Excel"  Switches windows focus to the window that begins with "Microsoft Excel"
Go to Top
Flow Control - Control Blocks


If Statement:

if block& = 0 then
sline = "{Shift+End}"
else
sline = "{Shift+Down "+CStr(block&)+"}{Shift+End}"
end if


While Statement

block& = val(ListVar1)
loop& = block&
while ( loop& )
Sendkeys "{End}{Enter}"
loop& = loop& - 1
wend


Case Statement

Select Case expr
[Case caseexpr[, ...]
statements]...
[Case Else
statements]
End Select

caseexpr Description
expr Execute if equal.
Is < expr Execute if less than.
Is <= expr Execute if less than or equal to.
Is > expr Execute if greater than.
Is >= expr Execute if greater than or equal to.
Is <> expr Execute if not equal to.
expr1 To expr2 Execute if greater than or equal to expr1 and less than or equal to expr2.

Advanced Dragon/VB Commands


Substring Search Syntax

for list format "Written\Spoken"

Lc% = Instr(ListVar1,"\") - 1
TextVal$=MID$(ListVar1,1,Lc%)
SendKeys TextVal$

or
TextVal$=MID$(ListVar1,1,(Instr(ListVar1,"\") - 1))

Diagnostic Example: Test List <list_items>

' (c) 2003 EXAQ Micro Services, all rights reserved
SendKeys "1. Selected value:{Enter}"
SendKeys ListVar1
SendKeys "{Enter}2. Count to divisor:{Enter}"
Lc% = InStr(ListVar1,"\")
SendKeys CStr(Lc%)
SendKeys "{Enter}3. Count to cutoff:{Enter}"
Lc% = Lc% - 1
SendKeys CStr(Lc%)
SendKeys "{Enter}4. Resulting Value:{Enter}"
TextVal$=Mid$(ListVar1,1,Lc%)
SendKeys TextVal$
SendKeys "{Enter}Command Complete.{Enter}"



DragonBar Message
Show a message on the DragonBar

EngineControl.DragonBar.ShowMessage showmessageNoBeep, "message"

Sounds

  • Say Back
PlaySound "C:\WINNT\Media\start.wav"

  • "Click"
PlaySound "C:\WINNT\Media\start.wav"



Reference Index
Go to Top

© 2003-2009 EXAQ Micro Services, Sacramento, California


NaturallySpeaking 6.0 and Lower VB commands

Go to Top

DNS: SendKeys Statement

  • Sends one or more keystrokes to the active window as if typed at the keyboard.
  • Syntax: SendKeys string

The SendKeys statement syntax has these named arguments:

  • String expression (required) specifying the keystrokes to send.

Remarks

To represent ABC abc 123 use "ABC abc 123"  for string.
To specify non printing keys such as ENTER or TAB, and function keys:
  • BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
  • BREAK {BREAK}
  • CAPS LOCK {CAPSLOCK}
  • DEL or DELETE {DELETE} or {DEL}
  • DOWN ARROW {DOWN}
  • END {END}
  • ENTER {ENTER}
  • ESC {ESC}
  • HELP {HELP}
  • HOME {HOME}
  • INS or INSERT {INSERT} or {INS}
  • LEFT ARROW {LEFT}
  • NUM LOCK {NUMLOCK}
  • PAGE DOWN {PGDN}
  • PAGE UP {PGUP}
  • PRINT SCREEN {PRTSC}
  • RIGHT ARROW {RIGHT}
  • SCROLL LOCK {SCROLLLOCK}
  • TAB {TAB}
  • UP ARROW {UP}
  • F1-F16 {F1}-{F16}
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, enclose the key in braces {} and precede the key code with one or more of the following codes:
  • SHIFT+
  • CTRL+
  • ALT+
For example: to press "Alt f" use {Alt+f}, to press Shift, Ctrl, Function 2 use {Shift+Ctrl+F2}.
Repeating Keys: To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.
Note: You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows. SendKeys also can't send the PRINT SCREEN key {PRTSC} to any application.

List Commands with SendKeys using:
  • _Argx
x is a one based index for parameter retrieval.  

Example for "Move  <Direction> <1to5>" command where <Direction> contains UP, DOWN, RIGHT, LEFT and <1to5> contains 1,2,3,4,5
  • SendKeys "{"+_Arg1+" "+_Arg2+"}"

Go to Top

DNS: Wait Statement

  • Pauses execution of the program for the specified amount of time
  • Syntax: Wait milliseconds

The Wait statement syntax has these named arguments:

  • milliseconds (required) Integer expressing the 1/1000s of a second to wait.  A value of 3500 would produce a 3.5 second pause, a value of 100 would produce a 1/100 second pause.

Remarks

none

Reference Index
Go to Top

© 2003-2009 EXAQ Micro Services, Sacramento, California



Version List

Ver
Date
Description
2.0
03/6/09
  • Sounds added
  • Date strings added
  • Documentation reorganized
  • This version Documentation added
1.5
01/27/09
  • Documentation secitions revised for easier reading
  • AppActivate added
  • Dragon Bar messages added
1.0
2000-2008
  • Prior Versions





2.0  2/22/09