Sunday, December 31, 2017

WaitForWindow a useful command which has been abandoned by Nuance

Dragon scripting language extensions quick reference

I have been finding difficulties in running my script using Dragon NaturallySpeaking 14 and I would have found this to be very useful

WaitForWindow

The WaitForWindow command suspends execution of the script until a desired window appears in the foreground.

Note

This command works only for legacy Dragon version 5 commands that have been imported into version 8. It will not work in commands that you create using the MyCommands editor.

Syntax

WaitForWindow caption [, windowClass [, timeout ] ]
ArgumentDescription
captionA text string to match against the window caption. The string may (and often will) include the asterisk (*) character as a wild-card to match against variable parts of the window caption. If parts of the actual window caption are guaranteed to be unpredictable, you MUST use an * wild-card to get a successful match.

The caption may also be an empty string "," to indicate that the caption does not matter.
windowClassA text string which, when not empty (""), must exactly match (case-sensitive) the window class name of the window you are looking for. The window class name is usually obtainable only through programmer utilities like "Spy".
timeoutThe length of time, in milliseconds, to wait for the window to appear. If no matching window appears by then, a timeout error is displayed, and the script stops without executing any subsequent commands following WaitForWindow. If not specified, defaults to 10 seconds.

Examples

In the following example the * in the caption is an instruction to ignore "Document1".
AppBringUp "(correct path here)winword.exe"
WaitForWindow "*Microsoft Word"
SendKeys "this text will appear in the Word document, not the splash screen"
The following example waits for Word's main window by class name.
AppBringUp "(correct path here)winword.exe"
WaitForWindow "," "OpusApp"
SendKeys "this text will appear in the Word document, not the splash screen"
The following example starts Microsoft Outlook, waits as long as 30 seconds in case the network is slow, and then types Alt+n to create a new E-mail.
AppBringUp "(correct path)outlook.exe"
WaitForWindow "*Microsoft Outlook", "," 30000
SendSyste
The Dragon scripting language extensions provide a set of tools for creating Dragon voice commands.
Dragon Advanced Scripting lets you use programming languages such as Microsoft® VBA to program commands that can perform virtually any function on the computer with voice commands.
The Dragon scripting commands, listed below, are the commands that you can specify in the Command parameter of the Add method.
See the topics guidelines for writing scripts and voice command list variables for more information on using the following:

Dragon scripting language extensions

A

B

C

D

G

H

M

P

R

S

T

W

Reference

No comments: