mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
Update the speak-*.ps1 scripts
This commit is contained in:
@ -16,17 +16,17 @@
|
||||
param([string]$text = "")
|
||||
|
||||
try {
|
||||
if ($text -eq "") { $text = read-host "Enter the Latin text to speak" }
|
||||
if ($text -eq "") { $text = Read-Host "Enter the Latin text to speak" }
|
||||
|
||||
$TTS = New-Object -ComObject SAPI.SPVoice
|
||||
foreach ($Voice in $TTS.GetVoices()) {
|
||||
if ($Voice.GetDescription() -like "*- Latin*") {
|
||||
$TTS.Voice = $Voice
|
||||
foreach ($voice in $TTS.GetVoices()) {
|
||||
if ($voice.GetDescription() -like "*- Latin*") {
|
||||
$TTS.Voice = $voice
|
||||
[void]$TTS.Speak($text)
|
||||
exit 0 # success
|
||||
}
|
||||
}
|
||||
throw "No Latin voice for text-to-speech (TTS) found - please install one"
|
||||
throw "No Latin text-to-speech voice found - please install one"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
|
Reference in New Issue
Block a user