Update the scripts

This commit is contained in:
Markus
2021-09-27 17:16:29 +02:00
parent b653133853
commit 75e2952be0
5 changed files with 31 additions and 36 deletions

View File

@ -16,13 +16,12 @@ param([string]$text = "")
try {
if ("$text" -eq "") { $text = read-host "Enter the English text to speak" }
$Voice = New-Object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()
foreach ($OtherVoice in $Voices) {
$Description = $OtherVoice.GetDescription()
if ($Description -notlike "*- English*") { continue }
$Voice.Voice = $OtherVoice
[void]$Voice.Speak($text)
$CurrentVoice = New-Object -ComObject SAPI.SPVoice
$Voices = $CurrentVoice.GetVoices()
foreach ($Voice in $Voices) {
if ($Voice.GetDescription() -notlike "*- English*") { continue }
$CurrentVoice.Voice = $Voice
[void]$CurrentVoice.Speak($text)
exit 0 # success
}
throw "No English text-to-speech voice found - please install one"