23 January 2014

A little while ago I had a dilemma brought to me at work from an application team.  One of the tings we have fought using the Dragon Naturally Speaking application is the loss of data or profile corruption due to the application not being properly shut down.

The solution provided to us by a third party vendor was bloated and seemed much more complex than it needed to be.  An AutoIT script was written by someone in my company to use the files provided by the vendor.  It was the AutoIT script that called a batch file, which called cscript to run a vbs file (which did the saving), then went back to the AutoIT to call a com file which called an executable (created by one of the vendors) to close Dragon.  Did you get lost?  I was for a while trying to figure out what the scripts were doing and why.

It’s a simple process and the execution should be simple as well (although in IT that is often not the case).  So, I set out to find a way to do it.  Upon inspecting the COM I noticed it pointed to DragonCloser.exe which appeared to be a custom executable that the third party vendor wrote (or maybe Nuance did…).  So, there must be an API to use.  I looked it up and found an SDK online but I was hesitant to use it because one of my goals was not to have to push additional files to all of the PC’s that use Dragon.  I also didn’t want to modify the scripted package I wrote to install Dragon.

After taking another look at the VBS script I noticed it was creating an object without ever loading an assembly or any library of any sort.  This was the clue I needed to know that all I really needed was already loaded on the PC’s.  I dove into the Program Files directory and found Interop.DNSTools.dll. Interop obviously standing for Interoperability and that was exactly what I was looking to do.  I opened up the library in visual studio and browsed for the function I found in the VBS script.  Now I knew what I needed to do.

The resulting Powershell script is only 7 lines.  You can view/download it here:  SaveAndCloseDragon

It’s fully commented and shouldn’t be too hard to follow.  I hope this helps anyone looking to solve this issue.  You can set it as a logoff script on any computer running Windows Vista or higher.  I’m not sure if XP can do Powershell scripts or if installing Powershell adds that functionality to the logoff scripts area.


There are no comments.



You must be logged in to post a comment.

Links

RSS 2.0 Feed

Support

Brave Rewards
This site supports Brave Rewards. Please consider tipping or adding it to your monthly contributions if you find anything helpful!

For other ways: Support

Support this blog! If you have found it helpfu you can send me crypto. Any amount is appreciated!
ETH: 0xBEaF72807Cb5f4a8CCE23A5E7949041f62e8F8f0 | BTC: 3HTK5VJWr3vnftxbrcWAszLkRTrx9s5KzZ | SHIB: 0xdb209f96dD1BdcC12f03FdDfFAD0602276fb29BE
Brave Users you can send me BAT using the browser.