Skip to content

Instantly share code, notes, and snippets.

@Karunamon
Last active July 24, 2023 15:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Dragon restart script
$processes = @("natspeak", "dragonbar", "dgnria_nmhost", "dgnsvc", "dgnuiasvr", "dgnuiasvr_x64")
foreach ($process in $processes) {
if (Get-Process $process -ErrorAction SilentlyContinue) {
Stop-Process -Name $process -Force
}
}
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null
$form = New-Object System.Windows.Forms.Form
$form.Size = New-Object System.Drawing.Size(300,200)
$form.StartPosition = "CenterScreen"
$form.Text = "Dragon Slayer"
$button = New-Object System.Windows.Forms.Button
$button.Location = New-Object System.Drawing.Size(100,50)
$button.Size = New-Object System.Drawing.Size(100,30)
$button.Text = "Respawn Dragon"
$form.Controls.Add($button)
$button.Add_Click({
#Horrible hack because Dragon breaks if we run it elevated
Start-Process explorer.exe -ArgumentList "C:\Program Files (x86)\Nuance\NaturallySpeaking15\Program\natspeak.exe"
$form.Close()
})
$form.ShowDialog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment