Initial attempts to use the scripting language built into NaturallySpeaking Professional Edition to develop custom commands were promising. But as the scripting project became more complex, two difficulties were encountered:
1. Commands that send more than eight or ten keystrokes execute slowly. (Some of the commands send 30 or more keystrokes.)
2. A NaturallySpeaking 9.x "bug" makes it difficult to script certain commands. To reduce the need to memorize commands, I chose command names that exactly matched field labels. For example, saying "First Name" navigates to the "First Name" field. Although most labels appear only once in the application, 40 appear two or more times. The straightforward way to script commands with identical names is to make them window-specific. The scope (availability) for a command is restricted to the window in which the command is active. Unfortunately, the NaturallySpeaking 9.5 MyCommands Editor prohibits duplicate command names for Internet Explorer windows. Although creating two or more commands that share a name is possible, coding them is not simple.
The workaround to both problems was to script NaturallySpeaking commands that trigger Macro Express scripts. The Macro Express "Text Type" command outputs keystrokes significantly faster than the NaturallySpeaking "SendKeys" command. Furthermore, setting the scope to Internet Explorer windows is straightforward and reliable with Macro Express.
I experimented with two ways for NaturallySpeaking to trigger Macro Express scripts: (1) NaturallySpeaking sends keystrokes to launch a Macro Express hotkey macro; (2) NaturallySpeaking activates a shell command to launch a Macro Express macro. In theory, the first method should execute more quickly, and the second method should be more reliable. In practice, both methods worked equally well.
Use NaturallySpeaking Professional edition to trigger a Macro Express script nicknamed "test 1" and activated by Ctrl+Alt+T:
Sub Main ' Note: ^ = Control, % = Alt, + = Shift SendKeys "^%t" End Main
Sub Main ' Note: Use /A switch before Macro Express nickname ShellExecute "[macro_express_folder_path]\meproc.exe /Atest 1" End Main