Custom Scripting Macros for Dragon
NGT, Inc. can provide custom scripting services to automate some of the most common functions necessary for clinical staff to complete activities in electronic medical records (EMR). Services include text macros which provide the ability of the clinician to use a short phrase to launch an extensive amount of text, complete templates, templates including variables, as well as voice commands including variable lists. Scripting services can be provided on-site or remotely, and we provide ongoing support for proprietary scripts in our standard fees. Services are provided on a Proposal basis and we provide an initial consultation with no-cost. Contact President and CEO, Edward S. Rosenthal, for additional information.
Dragon Professional 9 offers a robust scripting interface with four discrete tools:
- Text & Graphic
- Macro Recorder (i.e., mouse movement recorder)
- Step-By-Step
- Advanced Scripting
Extensive help files support the scripting tools and NGT, Inc. also offers a definitive manual for writing macros and scripts for Dragon Medical 10-written by Larry Allen, it's available both in print and electronic format.
Text and Graphic Macro Writing
To write a global text macro select existing text on the screen and say “Make That a Shortcut". This will open the new command tool and copy the selected text into the content portion of the command tool. Alternatively one can say "Create new command," or use the Dragon bar menu Tools/Add New Command. The new command wizard will deploy. Once the tool has deployed there are four basic steps to writing a global text macro:
- Write a command phrase to launch the Text macro. It should be two or three words and not sound like a common phrase to prevent unintended launches.
- Enter text content to be deployed when the command phrase is recognized. (If the "Make That a Shortcut" command was used the text should reappear in the Content window.
- Check the Plain Text checkbox -this will allow the text macro to take on the target attributes when launched (ie., if the text environment is Times New Roman 10 the text will appear in that font and size).
- Click the Save Control.

Step-By-Step Macro Writing
These are used for writing voice launched dot phrases and quick texts, calling functionality from EMR applications. To write a Step-By-Step macro.
- Say, can say "Create new command," or use the Dragon bar menu Tools/Add
New Command. The new command wizard will deploy.

- On the MyCommand Name line enter the phrase that will be used to launch
the dot phrase. Although many physicians feel that the launch phrase should
be the same as the keystroke (e.g. they want to say “dot ohvee” for ‘.ov’)
generally the best recognition accuracy would take place by using a phrase
more are in line with “dot office visit”-which if entered in this fashion on
the MyCommand Name line also has the added pedantic of being distinct from
regular discourse so not only will this have high recognition probability,
but also is not likely to be confused by the system as a text activity as
long as the user pauses both before and after saying the launch phrase.

- Change the command type to "Step-by-Step."

- Set the first command step to “Type Text”

- In the after executing the Insert control to the right of the Type Text
in the New Step box a dialogue called Type Text Step will appear. Type the
literal dot phrase into the ‘Specify the text to be typed:’ field and
activate the Okay control.

- Change the New Step to Keystroke and activate the Insert Control. When
the key capture window appears hit the Enter key to capture this as the next
step.

- As long as the command window looks like the example below use the Save
control and you will have created a voice command that will launch the dot
phrase directly into the EMR application.

Match Destination Formatting
To write a macro to use the "Match Destination Formatting" tool in Microsoft Word create a command using the Step-by-Step keystroke tool:
- Put in the command name "Match Destination Formatting"
- Change the Command Type to Step-by-Step
- By default the New Step control will show Keystrokes. Click the Insert control or use Alt+R to activate. This will deploy a simple key capture window. Press the keys Alt+Shift+F10 (the hot key associated with activating a Smart Tag). Activate the Okay control. Reactivate the Insert control and press the "D" key on the keyboard, followed by the Okay control.
- Use the Save control.

When a Smart Tag appears the command Match Destination Formatting will complete the execution of this function in the Smart Tag.
Go to Work Orders
The following step-by-step script can be used in Outlook 2003 to put focus on a specific folder. It can also be written as a variable macro which would allow the use of a list to reference the specific folder name.
- With the MyCommands Editor in Step-by-Step mode, type in, "Go To Work Orders" in the MyCommand Name field.
- Into the Steps field type or cut and paste the following:
Send Keys "^y" Send Keys "%f" Type "WORKORDERS" Wait 50 milliseconds Send Keys "{Enter}" - Press the save button to save your command and close the editor.

Advanced Scripting Macros
The first Advanced Scripting macro comes from the examples available in the Dragon Pro Command Browser.

' This command shows how to refer to variables. If you
' say, for example, "sample script three elephants" it
' types the word "elephant" three times.
' 1to10 is an existing variable used in many built-in
' commands. samplelist is a variable created just
' for this command.
' UtilityProvider.ContextValue(0) contains the value
' spoken in place of 1to10.
' UtilityProvider.ContextValue(1) contains the value
' spoken in place of samplelist.
Option Explicit
Dim i As Integer
Dim j As Integer
Sub Main
j = str2int(UtilityProvider.ContextValue (0))
For i = 1 To j
SendDragonKeys " " + UtilityProvider.ContextValue(1)
SendDragonKeys "{Backspace}" 'to remove the s
Next i
End Sub
Function str2int (num As String )
Select Case num
Case "one"
str2int = 1
Case "two"
str2int = 2
Case "three"
str2int = 3
Case "four"
str2int = 4
Case "five"
str2int = 5
Case "six"
str2int = 6
Case "seven"
str2int = 7
Case "eight"
str2int = 8
Case "nine"
str2int = 9
Case "ten"
str2int = 10
End Select
End Function
Outlook Calendar Macro
This is an example of advanced scripting using a double variable that would allow the user to put in both month and date with a single command to search through the calendaring system in Microsoft Outlook. It allows voice activated date dictation in the Outlook Calendar view.
Type or cut and paste the following into the Script field of the MyCommand Editor in Advanced Scripting mode:
Sub Main
SendDragonKeys"{Ctrl+g}"
If ListVar1= "January" Then SendDragonKeys"01/"
If ListVar1= "February" Then SendDragonKeys"02/"
If ListVar1= "March" Then SendDragonKeys"03/"
If ListVar1= "April" Then SendDragonKeys"04/"
If ListVar1= "May" Then SendDragonKeys"05/"
If ListVar1= "June" Then SendDragonKeys"06/"
If ListVar1= "July" Then SendDragonKeys"07/"
If ListVar1= "August" Then SendDragonKeys"08/"
If ListVar1= "September" Then SendDragonKeys"09/"
If ListVar1= "October" Then SendDragonKeys"10/"
If ListVar1= "November" Then SendDragonKeys"11/"
If ListVar1= "December" Then SendDragonKeys"12/"
SendDragonKeys"{" & ListVar2 & "}"
SendDragonKeys"{Enter}"
End Sub
Page Last Updated: Monday, June 29, 2009
Copyright 1999- 2009 Next Generation Technologies Incorporated