KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Autohotkey Script to Close Dragon without Saving the User Profile and Restarts
Topic Summary:
Created On: 12/10/2019 12:39 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 12/10/2019 12:39 PM
User is offline View Users Profile Print this message


Rapp
Senior Member

Posts: 97
Joined: 12/12/2007

I have attached a Autohotkey script that closes the current user profile without saving, exits Dragon, and then starts Dragon again. You can also execute the script from Advanced Scripting in Dragon: ShellExecute "FullScriptPathandName"

If anyone has enhancements to the script, please let me know.

 12/11/2019 11:43 AM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 1934
Joined: 03/21/2007

You might consider closing DragonBar.exe too separately. And even the logging service or UI automation servers (dgnuiasvr.exe and _64), etc. Someone here wrote a batch file which works well (and can be run directly or executed by a script).

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




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.

 12/11/2019 07:13 PM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 770
Joined: 04/03/2009

With recent changes to KnowBrainer the batch file had to be "run as administrator" (at least on my Windows 10 machine). I started exploring workarounds. One version is to create a shortcut to the batch file on the Desktop and change the shortcut’s property so that it runs as administrator. I did not have great success with this although it sometimes work. I finally wrote a tiny C# application in Visual Studio 2017:

using System.Diagnostics;

using System.Threading;

 

namespace KillDragon {

   class Program {

      static void Main(string[] args) {       // PIDs  

         EndProcessTree("KBPro.exe");       //5264  

         Thread.Sleep(2000);//sleep 2 seconds

         EndProcessTree("ProcHandler.exe");  //9864

         //EndProcessTree("KBProcHandler.exe");

         //EndProcessTree("pcbvWndProc1928.exe");

         Thread.Sleep(1000);//sleep 1 second

         EndProcessTree("dragonbar.exe");   //18008

         EndProcessTree("dgnuiasvr.exe");   //12644

         EndProcessTree("dgnuiasvr_x64.exe");  //700

         EndProcessTree("dgnsvc.exe");      //10500

         EndProcessTree("natspeak.exe");     //18088    

         //EndProcessTree("formfiller.exe");      

         //EndProcessTree("dgnria_nmhost.exe");

         //EndProcessTree("nsbrowse.exe");

         //the commented out trees are from older versions and helpers

      }

 

      private static void EndProcessTree(string imageName) {

         Process.Start(new ProcessStartInfo {

            FileName = "taskkill",

            Arguments = $"/im {imageName} /f /t",

            CreateNoWindow = true,

            UseShellExecute = false

         }).WaitForExit();

      }   

   }

 

}

As with the batch file it has a tendency to leave the icons in the tray (a minor irritation but no impediment to restarting KnowBrainer and/or Dragon). I've experimented around with solutions for clearing these icons from the tray and I suspect that I am fairly close to a solution but the visual irritation is not enough to spur me on to finding a solution.


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

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Word 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card

 12/11/2019 08:07 PM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1036
Joined: 08/16/2010

SP Pro performs all necessary operations including cleaning up the Dragon/KB/VC/SS+ ghost icons with one single Hotkey (Ctrl+Alt+Down). If speech is still available you can also use a voice command. 

 

No need to create any scripts. However cleaning up the ghost icons will only work of course if you have the "Always show icons in the notification area" set to On. Which is recommended anyway if you want to see what's going on on your computer.

 

Here's an example of quickly restarting Dragon + VC.



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

www.speechproductivity.eu 


The Ultimate Dictation Box for Dragon - SP Ergonomic Text Editor - Hotkeys for Dragon - Better Text to Speech - Easy Guide to Dragon Scripting

 12/12/2019 01:36 PM
User is offline View Users Profile Print this message


Rapp
Senior Member

Posts: 97
Joined: 12/12/2007

With respect to SP Pro, does the process close the user profile or simply kill the process?  I don't want the user profile to be damaged, and so I prefer closing and not saving to minimize the chance of damage to the profile. 

 12/12/2019 04:43 PM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1036
Joined: 08/16/2010

Rapp,

 

The Dragon and VC (+KB + SS+) Restart utility kills these processes, cleans up orphan icons and (optionally) relaunches these add-ons. It's mostly meant if Dragon has become unresponsive/unstable and voice commands don't work anymore. In these cases you probably don't want to save your user profile anyway  

 

You can also use the tool if you are in a lazy mood ;-). If none of the above add-ons are currently running it will restart just Dragon (so it's not a condition to have these add-ons installed in order to run the utility).

 

The user can choose one of the following combinations: Dragon + VC Restart or Dragon + KB + SS+ Restart

I could combine all into one but that wouldn't make much sense since those who use VC usually don't use SS+ and combining VC with KB is not always a good idea.



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

www.speechproductivity.eu 


The Ultimate Dictation Box for Dragon - SP Ergonomic Text Editor - Hotkeys for Dragon - Better Text to Speech - Easy Guide to Dragon Scripting



 12/12/2019 02:07 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 37356
Joined: 10/01/2006

If you kill the Dragon process, you will not damage your user profile but assuming you are using KnowBrainer, all you have to do is say Close Dragon and KnowBrainer to immediately shut down Dragon and KnowBrainer, without saving your profile. Since this is a mission-critical command, you are prompted before the command will take effect.



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

Forum Mission Statement
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ext 1

Statistics
31556 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 3936 on 09/08/2015 at 11:44 AM.
There are currently 337 guests browsing this forum, which makes a total of 339 users using this forum.

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