Skip to content

Instantly share code, notes, and snippets.

@Karunamon
Last active July 24, 2023 15:37
Show Gist options
  • Save Karunamon/f2b684d083fc341ee79aab1fb29cf3c5 to your computer and use it in GitHub Desktop.
Save Karunamon/f2b684d083fc341ee79aab1fb29cf3c5 to your computer and use it in GitHub Desktop.
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