mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-22 18:08:18 +02:00
Update speak-english.ps1
This commit is contained in:
parent
4bb056654f
commit
e6ef816d5c
@ -16,12 +16,12 @@
|
|||||||
param([string]$text = "")
|
param([string]$text = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ("$text" -eq "") { $text = read-host "Enter the English text to speak" }
|
if ("$text" -eq "") { $text = Read-Host "Enter the English text to speak" }
|
||||||
|
|
||||||
$TTS = New-Object -ComObject SAPI.SPVoice
|
$TTS = New-Object -ComObject SAPI.SPVoice
|
||||||
foreach ($Voice in $TTS.GetVoices()) {
|
foreach ($voice in $TTS.GetVoices()) {
|
||||||
if ($Voice.GetDescription() -like "*- English*") {
|
if ($voice.GetDescription() -like "*- English*") {
|
||||||
$TTS.Voice = $Voice
|
$TTS.Voice = $voice
|
||||||
[void]$TTS.Speak($text)
|
[void]$TTS.Speak($text)
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user