KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: pgEmulate - create keyboard shortcuts for Dragon commands
Topic Summary: Using native Windows features (no hacks)
Created On: 03/29/2019 02:38 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 pgEmulate - create keyboard shortcuts for Dragon commands   - PG LTU - 03/29/2019 02:38 PM  
 pgEmulate - create keyboard shortcuts for Dragon commands   - framage-ccplab - 05/22/2019 03:06 PM  
 pgEmulate - create keyboard shortcuts for Dragon commands   - monkey8 - 05/22/2019 04:32 PM  
 pgEmulate - create keyboard shortcuts for Dragon commands   - PG LTU - 05/23/2019 03:17 PM  
 pgEmulate - create keyboard shortcuts for Dragon commands   - kkkwj - 12/04/2019 01:36 AM  
 pgEmulate - create keyboard shortcuts for Dragon commands   - PG LTU - 12/04/2019 10:23 AM  
 pgEmulate - create keyboard shortcuts for Dragon commands   - PG LTU - 01/22/2020 05:47 PM  
Keyword
 03/29/2019 02:38 PM
User is online View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 2197
Joined: 03/21/2007

There is an easy way to create a shortcut for any (or an arbitrary) Dragon command.

 

First create a tiny pgEmulate.vbs script and put it somewhere accessible. This script, when run directly, presents an input box that lets you type or dictate some text for Dragon to recognize. So if you type in or dictate a command name (careful of capitalization, which counts here), Dragon will treat that input as if you said it. The script also lets you optionally pass in a parameter for what you want to say, so skips the input box and goes right to recognizing that text.

 

For the first version, create a shortcut on your desktop to the vbs script. Assign it a shortcut key (apparently you can only use Ctrl + Alt + Letter combos in the Shortcut properties) or use AHK or ME to assign any hotkey or hotstring combo of your choice. For the second version, just edit the target property to add the command to be recognized in quotes, such as:

 

C:\pgEmulate.vbs "what can I say"

 

and give it a shortcut key, too.

 

Here is pgEmulate.vbs (create in any text editor, just make sure to change the extension from .txt to .vbs).


if WScript.Arguments.Count > 0 then x = WScript.Arguments(0)
if x = "" then x = InputBox("Enter your command or text:")
Set Dgn = GetObject("","Dragon.DgnEngineControl")
Dgn.Register
if x <> "" then Dgn.RecognitionMimic(x)
Dgn.UnRegister(0)
Set Dgn = Nothing


 

If you put this in a convenient spot, you can use it in your scripts to asynchronously run a recogniton:

ShellExecute "D:\path to\pgEmulate.vbs ""phrase to be recognized""", 6

 

Or, with a variable expression:

x = "phrase to be recognized"
ShellExecute "D:\path to\pgEmulate.vbs """ & x & """", 6

 

More about ShellExecute and that 6 at the end: here.  (Hint, it's supposed to run in a minimized background window - ymmv.)

 

Hth,



-------------------------




PG





Remember folks, my comments and this forum are for entertainment value only, please, no wagering or other reliance on the contents herein.  I permit no commercial use of my ideas (whether expressions or embodiments) without my written consent.



Statistics
32287 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 355 guests browsing this forum, which makes a total of 357 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.