mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
Added speak-file.ps1
This commit is contained in:
19
Scripts/speak-text.ps1
Executable file
19
Scripts/speak-text.ps1
Executable 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
|
Reference in New Issue
Block a user