################################################################### ## Description: Imports a class library that was installed with Dragon to be able to ## call it's functions to control the current speaker and their profile within the Dragon ## application. Script will save the users profile and then close any natspeak.exe process ## that it finds. ## ## This script is provided as is and may be freely used and distributed so long as proper ## credit is maintained. ## ## Written by: ## Date Modified: 01-06-14 ################################################################### add-type -Path "C:\Program Files (x86)\Nuance\NaturallySpeaking10\Program\Interop.DNSTools.dll" #library that has functions to control current speaker, must import it to have access to it's functions $dragon = new-object DNSTools.DgnEngineControlClass #specific class for controling the speaker engine and the current user $dragon.SpeakerSave() #function to save; saves to network location $natspeakList = get-process natspeak #pulling a list of all natspeak processes to close them all. sometimes multiple are open, if that is the case and all aren't closed, Dragon wont launch for next user ForEach ($process in $natspeakList) { $process | stop-process }