Added speak-file.ps1

This commit is contained in:
Markus Fleschutz
2020-12-08 15:11:01 +00:00
parent ec35a6cfb1
commit fc03bc6e29
3 changed files with 26 additions and 4 deletions

19
Scripts/speak-text.ps1 Executable file
View File

@ -0,0 +1,19 @@
#!/snap/bin/powershell
# Syntax: ./speak-text.ps1 [<text>]
# Description: speaks the given text by text-to-speech (TTS)
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
param([string]$Text)
if ($Text -eq "") {
$Text = "Hello World!"
}
try {
$voice = New-Object ComObject SAPI.SPVoice
$voice.Speak($Text);
exit 0
} catch { Write-Error $Error[0] }
exit 1