![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Is it possible to call dgnEngine from C# to have Dragon run a command? Topic Summary: Kind of like running HeardWord from an external program Created On: 01/03/2021 01:56 PM Status: Post and Reply |
|
![]() |
|||
Is is possible (and feasible) to call some Dragon API interface (like dgnEngine) to have it run a command in its command list? Does it do COM or do you have to link to it directly? I'm wondering if it is possible to write a simple DOS batch file something like this:
CallDragon "open command browser" CallDragon "open microsoft word" CallDragon "press backspace"
Or something like that. And the big question - does anyone have a small example program in any programming language that they are willing to share? (Every time I try to look at the hidden underlying documents beside the Dragon executables, I get scared and feel like I'm wasting time trying to figure out how to interact with the engine and its events...) ------------------------- Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|||
|
|||
![]() |
|||
I've never gone down the Common Object Model interface route with C#, always just created Advanced or KnowBrainer scripts. ------------------------- Thanks Mark
Dragon Professional Advanced Scripting/KnowBrainer Scripts |
|||
|
|||
![]() |
|||
I think you're looking for ComObjCreate("Dragon.DgnEngineControl") to mimic Dragon recognition.
The basic idea is roughly the same in most languages like AHK, WinBatch, Quick Macros but also in VBS:
DgnEngine:= ComObjCreate("Dragon.DgnEngineControl") DgnEngine.Register(0) DgnEngine.RecognitionMimic("stop listening")
In some languages you need to add Dgn.UnRegister as well.
Shouldn't be too hard to implement in C#. ------------------------- |
|||
|
|||
![]() |
|||
Thank you everyone, your input has helped. I already do input simulation with the virtual key codes (which is not the same as trying to harness the library of "things" that a user's library of commands can do. Rob, the COM example you posted is right on the money too - that's exactly how you do it in C# code (syntax is a bit different, of course). There are many examples on the net. Probably the key line of code that answered my question was the "DgnEngine.RecognitionMimic("text") line. (Thank you for reminding me, Rob.) I remember reading about the Create, DgnEngine.Register, mimic, Unregister sequence on the forum somewhere long ago, now that I see it in front of me.
I know some other people on the forum here have a regular practice of using external programs (like DragonEmulate or whatever) to feed commands into Dragon to make it think it "HeardWord" something. It must be a useful practice since they do it, so I was just thinking about it. I think Edgar passes dictation to Dragon to his program (to process the words) and then back to Dragon to get a functionality boost. If any one makes huge use of this pattern, I wonder if you would comment on the big benefits of the approach? I was just contemplating what benefits I could imagine if I did something like that, and posted here just to find out how easy it would be. (Easy, it looks like.) It's almost like you could treat Dragon as an intelligent "non-voice assistant for a natural-language scripting language." Just put your almost-natural-language "commands" in a text file and feed the file to Dragon as a scripting engine. Presto! Easier than learning a programming language, I suppose. :-) ------------------------- Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|||
|
|||
![]() |
|||
Regarding how to pass information from Dragon to a C# application, please see the YouTube video at: ------------------------- Thanks Mark
Dragon Professional Advanced Scripting/KnowBrainer Scripts |
|||
|
|||
![]() |
|||
Hi Mark, wow, your video was nice. I think that's the best video of yours that I have watched. It makes me want to learn and practice how easily you move around Visual Studio by voice, and to put grid stickers on my monitor to facilitate the movement. And thank you for putting your code up on Github too - your command browser looks very helpful. I wish I had more time to study and learn more from you and Edgar. But there are only 24 hours in a day (sigh). Happy New Year!
------------------------- Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|||
|
|||
![]() |
|||
Post (or link to) some code, please. I too have the same reaction to learning how to tame the Dragon®. ------------------------- -Edgar |
|||
|
|||
![]() |
|||
Post (or link to) some code, please. I too have the same reaction to learning how to tame the Dragon®.
Edgar, and everyone else posting to this thread: Stop wasting your time even thinking of it. -------------------------
|
|||
|
|||
![]() |
|||
Hi Kevin,
I think this is what you are asking for. I have attached a C# executable compiled from a C# project which took 30 minutes to produce using components supplied with a standard Dragon installation, DPI or DPG and visual studio 17. The application will explain itself when you run it but basically it shows you Dragon voice commands added into your application and it also demonstrates utilising existing Dragon voice commands in your application using the Dragon API, the application of course need not have a window. You will notice that calling an existing dragon command is instant unlike using heardword or recognitionMimic with scripting. You could always disassemble it to see how it's done or use our consultancy which is available for companies wanting to do this sort of thing.
You don't do it the way that has been described above in the relevant posts but it can be done as you can see when you run the executable. Let me know if it doesn't run for some reason.
Lindsay
EDIT: to download the zip file you need to right click on it and then choose "save Link as". I have also digitally signed the latest attachment to save you getting various warning screens when you try to run the unzipped executable.. You will however get a warning about downloading a zip file from KnowBrainer which you can ignore.
------------------------- |
|||
|
|||
![]() |
|||
Hi Lindsay, thank you for the convincing demo! It was flawless. I put it in the background by clicking on File Explorer (and/or Word), and the "show image 1/2" commands still went to the demo app, even though the demo app was not foreground. I suppose that's because those commands were global and know how to contact the demo app to do something. Most impressive, for sure. It goes way beyond what I was contemplating. I'll send you a PM about consulting.
------------------------- Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|||
|
|||
![]() |
|||
|
FuseTalk Standard Edition v4.0 - © 1999-2021 FuseTalk™ Inc. All rights reserved.