mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Update speak-spanish.ps1
This commit is contained in:
parent
0fb338466f
commit
443a762a70
@ -11,21 +11,21 @@
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param([string]$text = "")
|
||||
|
||||
try {
|
||||
if ($Text -eq "") { $Text = read-host "Enter the text to speak" }
|
||||
if ($text -eq "") { $text = read-host "Enter the Spanish text to speak" }
|
||||
|
||||
$Voice = new-object -ComObject SAPI.SPVoice
|
||||
$Voice = New-Object -ComObject SAPI.SPVoice
|
||||
$Voices = $Voice.GetVoices()
|
||||
foreach ($OtherVoice in $Voices) {
|
||||
$Description = $OtherVoice.GetDescription()
|
||||
if ($Description -notlike "*- Spanish*") { continue }
|
||||
$Voice.Voice = $OtherVoice
|
||||
[void]$Voice.Speak($Text)
|
||||
[void]$Voice.Speak($text)
|
||||
exit 0
|
||||
}
|
||||
write-error "No Spanish text-to-speech voice found - please install one"
|
||||
write-error "Sorry, no Spanish text-to-speech voice found - please install one"
|
||||
exit 1
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user