mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-02 14:44:50 +02:00
Remove obsolete voice-control.ps1
This commit is contained in:
parent
ec24595679
commit
494c697861
@ -270,7 +270,6 @@ turn-volume-down.ps1, Turns the audio volume down (-10% by default)
|
|||||||
unmute-audio.ps1, Unmutes audio
|
unmute-audio.ps1, Unmutes audio
|
||||||
upgrade-ubuntu.ps1, Upgrades Ubuntu Linux to the latest (LTS) release
|
upgrade-ubuntu.ps1, Upgrades Ubuntu Linux to the latest (LTS) release
|
||||||
upload-file.ps1, Uploads the local file to the given FTP server
|
upload-file.ps1, Uploads the local file to the given FTP server
|
||||||
voice-control.ps1, Executes the PowerShell scripts by voice
|
|
||||||
wakeup.ps1, Sends a magic packet to the given computer, waking him up
|
wakeup.ps1, Sends a magic packet to the given computer, waking him up
|
||||||
weather.ps1, Prints the current weather forecast
|
weather.ps1, Prints the current weather forecast
|
||||||
weather-report.ps1, Prints the local weather report
|
weather-report.ps1, Prints the local weather report
|
||||||
|
Can't render this file because it has a wrong number of fields in line 95.
|
@ -38,7 +38,7 @@ Mega Collection of PowerShell Scripts
|
|||||||
| [turn-volume-up.ps1](Scripts/turn-volume-up.ps1) | Turns the audio volume up (+10% by default) | [Help](Docs/turn-volume-up.md) |
|
| [turn-volume-up.ps1](Scripts/turn-volume-up.ps1) | Turns the audio volume up (+10% by default) | [Help](Docs/turn-volume-up.md) |
|
||||||
| [turn-volume-down.ps1](Scripts/turn-volume-down.ps1) | Turns the audio volume down (-10% by default) | [Help](Docs/turn-volume-down.md) |
|
| [turn-volume-down.ps1](Scripts/turn-volume-down.ps1) | Turns the audio volume down (-10% by default) | [Help](Docs/turn-volume-down.md) |
|
||||||
| [unmute-audio.ps1](Scripts/unmute-audio.ps1) | Unmutes the audio device | [Help](Docs/unmute-audio.md) |
|
| [unmute-audio.ps1](Scripts/unmute-audio.ps1) | Unmutes the audio device | [Help](Docs/unmute-audio.md) |
|
||||||
| [voice-control.ps1](Scripts/voice-control.ps1) | Executes the PowerShell scripts by voice | [Help](Docs/voice-control.md) |
|
|
||||||
|
|
||||||
⚙️ Scripts to Manage Computers
|
⚙️ Scripts to Manage Computers
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Executes PowerShell scripts by voice
|
|
||||||
.DESCRIPTION
|
|
||||||
This script executes all the PowerShell scripts by voice.
|
|
||||||
.EXAMPLE
|
|
||||||
PS> .\voice-control.ps1
|
|
||||||
.NOTES
|
|
||||||
Author: Markus Fleschutz · License: CC0
|
|
||||||
.LINK
|
|
||||||
https://github.com/fleschutz/PowerShell
|
|
||||||
#>
|
|
||||||
|
|
||||||
[double]$MinConfidence = 0.04
|
|
||||||
$PathToRepo = "$PSScriptRoot/.."
|
|
||||||
|
|
||||||
try {
|
|
||||||
write-output "Init speech recognition engine..."
|
|
||||||
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
|
||||||
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Speech")
|
|
||||||
$speechRecogEng = [System.Speech.Recognition.SpeechRecognitionEngine]::new()
|
|
||||||
#$speechRecogEng.InitialSilenceTimeout = 15
|
|
||||||
$speechRecogEng.SetInputToDefaultAudioDevice()
|
|
||||||
|
|
||||||
write-output "Learn script files..."
|
|
||||||
$Items = get-childItem -path "$PathToRepo/Scripts/"
|
|
||||||
$Count = 0
|
|
||||||
foreach ($Item in $Items) {
|
|
||||||
$Name = $Item.Name.Split('.')[0]
|
|
||||||
if ($Name -eq "") { continue }
|
|
||||||
$grammar1 = [System.Speech.Recognition.GrammarBuilder]::new()
|
|
||||||
$grammar1.Append($Name)
|
|
||||||
$speechRecogEng.LoadGrammar($grammar1)
|
|
||||||
$Count++
|
|
||||||
}
|
|
||||||
|
|
||||||
write-output "Learn internal command (exit)..."
|
|
||||||
$grammar2 = [System.Speech.Recognition.GrammarBuilder]::new()
|
|
||||||
$grammar2.Append("exit")
|
|
||||||
$speechRecogEng.LoadGrammar($grammar2)
|
|
||||||
|
|
||||||
write-output "NOTE: make sure the microphone volume is not too silent or too loud!"
|
|
||||||
|
|
||||||
write-output "Listening now ($Count voice commands)..."
|
|
||||||
while ($true) {
|
|
||||||
$recognized = $speechRecogEng.Recognize()
|
|
||||||
if ($recognized.confidence -lt $MinConfidence) { write-host -noNewline "?"; continue }
|
|
||||||
$myWords = $recognized.text
|
|
||||||
foreach ($Item in $Items) {
|
|
||||||
$Name = $Item.Name.Split('.')[0]
|
|
||||||
if ($Name -eq $myWords) {
|
|
||||||
write-host "$Name ($($recognized.confidence) %)..."
|
|
||||||
& "./$Item"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($myWords -match "exit") { write-host -noNewline "$Name ($($recognized.confidence) %)"; break }
|
|
||||||
}
|
|
||||||
exit 0 # success
|
|
||||||
} catch {
|
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
|
||||||
exit 1
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user