Update the speak-*.ps1 scripts

This commit is contained in:
Markus Fleschutz 2023-08-06 11:27:49 +02:00
parent 33a42c2547
commit 001c19a2b3
21 changed files with 88 additions and 88 deletions

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Arabic text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Arabic text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Arabic*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Arabic*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Arabic voice for text-to-speech (TTS) found - please install one"
throw "No Arabic text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,7 +16,7 @@
param([string]$Name = "")
try {
if ($Name -eq "") { $Name = read-host "Enter the name of the checklist" }
if ($Name -eq "") { $Name = Read-Host "Enter the name of the checklist" }
$Lines = Get-Content -path "$PSScriptRoot/../Data/Checklists/$Name.txt"
clear-host

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Danish text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Danish text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Danish*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Danish*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Danish voice for text-to-speech (TTS) found - please install one"
throw "No Danish text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Dutch text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Dutch text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) {
if ($Voice.GetDescription() -like "*- Dutch*") {
$TTSVoice.Voice = $Voice
foreach ($voice in $TTSVoice.GetVoices()) {
if ($voice.GetDescription() -like "*- Dutch*") {
$TTSVoice.Voice = $voice
[void]$TTSVoice.Speak($text)
exit 0 # success
}
}
throw "No Dutch voice for text-to-speech (TTS) found - please install one"
throw "No Dutch text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -2,7 +2,7 @@
.SYNOPSIS
Speaks text in English
.DESCRIPTION
This PowerShell scripts speaks the given text with an English text-to-speech (TTS) voice.
This PowerShell script speaks the given text with an English text-to-speech (TTS) voice.
.PARAMETER text
Specifies the text to speak
.EXAMPLE
@ -26,7 +26,7 @@ try {
exit 0 # success
}
}
throw "No English voice for text-to-speech (TTS) found - please install one."
throw "No English text-to-speech voice found - please install one."
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,7 +16,7 @@
param([string]$File = "")
try {
if ($File -eq "") { $File = read-host "Enter path to text file" }
if ($File -eq "") { $File = Read-Host "Enter path to text file" }
$Text = Get-Content $File

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the French text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the French text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- French*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- French*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No French voice for text-to-speech (TTS) found - please install one."
throw "No French text-to-speech voice found - please install one."
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the German text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the German text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- German*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- German*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No German voice for text-to-speech (TTS) found - please install one"
throw "No German text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,7 +16,7 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Greek text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Greek text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
@ -26,7 +26,7 @@ try {
exit 0 # success
}
}
throw "No Greek voice for text-to-speech (TTS) found - please install one"
throw "No Greek text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Hindi text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Hindi text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Hindi*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Hindi*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Hindi voice for text-to-speech (TTS) found - please install one"
throw "No Hindi text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Italian text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Italian text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Italian*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Italian*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Italian voice for text-to-speech (TTS) found - please install one."
throw "No Italian text-to-speech voice found - please install one."
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Japanese text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Japanese text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Japanese*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Japanese*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Japanese voice for text-to-speech (TTS) found - please install one"
throw "No Japanese text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -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

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Mandarin text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Mandarin text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Mandarin*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Mandarin*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Mandarin voice for text-to-speech (TTS) found - please install one"
throw "No Mandarin text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Polish text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Polish text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Polish*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Polish*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Polish voice for text-to-speech (TTS) found - please install one"
throw "No Polish text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Portuguese text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Portuguese text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Portuguese*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Portuguese*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Portuguese voice for text-to-speech (TTS) found - please install one"
throw "No Portuguese text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Spanish text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Spanish text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Spanish*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Spanish*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Spanish voice for text-to-speech (TTS) found - please install one"
throw "No Spanish text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Swedish text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Swedish text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Swedish*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Swedish*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Swedish voice for text-to-speech (TTS) found - please install one"
throw "No Swedish text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1

View File

@ -16,7 +16,7 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the text to speak" }
$Voice = new-object -ComObject SAPI.SPVoice
[void]$Voice.Speak($text)

View File

@ -16,18 +16,18 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Turkish text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Turkish text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Turkish*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Turkish*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Turkish voice for text-to-speech (TTS) found - please install one"
throw "No Turkish text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}

View File

@ -16,17 +16,17 @@
param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Ukrainian text to speak" }
if ($text -eq "") { $text = Read-Host "Enter the Ukrainian text to speak" }
$TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Ukrainian*") {
$TTS.Voice = $Voice
foreach ($voice in $TTS.GetVoices()) {
if ($voice.GetDescription() -like "*- Ukrainian*") {
$TTS.Voice = $voice
[void]$TTS.Speak($text)
exit 0 # success
}
}
throw "No Ukrainian voice for text-to-speech (TTS) found - please install one"
throw "No Ukrainian text-to-speech voice found - please install one"
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1