I'm trying to create a voice command in Nuance Dragon (Professional Individual version) to switch my language input to Korean. I want it to press the associated hot keys, click the button to toggle to Hangul characters, and return the cursor to where it was when I started.
So basically:
- Get current position of mouse
- Press hot keys
- Click mouse at target location
- Set position of mouse to position in step one
I'm running into trouble with RememberPoint -- whenever I try to run the script, it gives me an error, telling me either that "Subs can't be used in expressions" (if put inside Sub Main) or that it expects a different command ("Expecting 'Declare|Delegate|Event|Function|Property|Sub|Const|Dim|Private|Public|Friend|Class|Enum|Module|Type' " if put outside Sub Main).
(NOTE: these are the two positions things I've tried, but I didn't do both of them at once, as below)
Dim originalPoint
originalPoint = RememberPoint
Sub Main
originalPoint = RememberPoint
End Sub
There is pretty much no documentation on RememberPoint*. I've looked through Dragon's samples , I've declare the variable as a String and Integer, and I've tried other declarations listed above. I expected RememberPoint to return a value in mouse coordinates but this seems wrong. Perhaps it should be something like a Sub or Event, but I've had no luck there.
Thanks!
Simon
*https://www.nuance.com/products/help/dragon/dragon-for-pc/scriptref/Content/scrptref/rememberpoint.htm, https://www.nuance.com/products/help/dragon/dragon-for-pc/scriptref/Content/scrptref/dragtopoint.htm
Hmmm lemme try again more directly as below may be more than what OP needs (see comment).
Are you just missing how it all works in practice? In code, you'll have to actually indicate where the mouse goes (or position it yourself) before the
RememberPoint
directive and then move the mouse to the end position in code (or by hand yourself) before theDragToPoint
is issued. In code, using the Dragon extensions, it is theSetMousePosition
command that you need:https://www.nuance.com/products/help/dragon/dragon-for-pc/scriptref/Content/scrptref/setmouseposition.htm
My below reference code (use at own sole risk) uses the
Wait
scripting extension so after hitting Run in the command Browser (or speaking the command name) you have 5 seconds to move the mouse to your start position. If you do nothing, the start position will be in the title bar of the active window (I hope - YMMV). You'll hear a beep to know 5 seconds are up. Then move the mouse to the end position, and 5 seconds later (you'll hear another beep) the drag will happen. By default, it moves the active window a bit to the right and down.hth,