mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 12:41:46 +02:00
Added speak-test.ps1
This commit is contained in:
24
Scripts/speak-test.ps1
Executable file
24
Scripts/speak-test.ps1
Executable file
@ -0,0 +1,24 @@
|
||||
#!/snap/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./speak-test.ps1
|
||||
.DESCRIPTION performs a test speak by text-to-speech (TTS)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$Voice = new-object -ComObject SAPI.SPVoice
|
||||
$Voice.Speak("This is the default voice")
|
||||
$Voice.Speak("Let's also try the other voices")
|
||||
|
||||
$Voices = $Voice.GetVoices()
|
||||
foreach ($OtherVoice in $Voices) {
|
||||
$OtherVoice.GetDescription()
|
||||
$Voice.Voice = $OtherVoice
|
||||
$Voice.Speak("1 2 3 - this is a test")
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Reference in New Issue
Block a user