mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-26 06:18:17 +01:00
Improved the scripts
This commit is contained in:
parent
3dc9fd05ba
commit
138a0d2b20
@ -9,11 +9,20 @@
|
||||
function Speak([string]$Text) {
|
||||
write-progress "$Text"
|
||||
$Voice = new-object -ComObject SAPI.SPVoice
|
||||
$Voices = $Voice.GetVoices()
|
||||
foreach ($OtherVoice in $Voices) {
|
||||
$Description = $OtherVoice.GetDescription()
|
||||
if ($Description -like "*- English (United States)") {
|
||||
$Voice.Voice = $OtherVoice
|
||||
break
|
||||
}
|
||||
}
|
||||
[void]$Voice.Speak($Text)
|
||||
write-progress -complete "$Text"
|
||||
}
|
||||
|
||||
try {
|
||||
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
||||
Speak("Today is $((Get-Date).ToShortDateString())")
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
function Speak { param([string]$Text)
|
||||
write-output "'$Text'"
|
||||
$Result = $Voice.speak("$Text")
|
||||
[void]$Voice.speak("$Text")
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -9,11 +9,20 @@
|
||||
function Speak([string]$Text) {
|
||||
write-progress "$Text"
|
||||
$Voice = new-object -ComObject SAPI.SPVoice
|
||||
$Voices = $Voice.GetVoices()
|
||||
foreach ($OtherVoice in $Voices) {
|
||||
$Description = $OtherVoice.GetDescription()
|
||||
if ($Description -like "*- English (United States)") {
|
||||
$Voice.Voice = $OtherVoice
|
||||
break
|
||||
}
|
||||
}
|
||||
[void]$Voice.Speak($Text)
|
||||
write-progress -complete "$Text"
|
||||
}
|
||||
|
||||
try {
|
||||
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
||||
Speak("It's now $((Get-Date).ToShortTimeString())")
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -11,6 +11,7 @@ $PathToRepo = "$PSScriptRoot/.."
|
||||
|
||||
try {
|
||||
write-output "Init speech recognition engine..."
|
||||
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
||||
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Speech")
|
||||
$speechRecogEng = [System.Speech.Recognition.SpeechRecognitionEngine]::new()
|
||||
#$speechRecogEng.InitialSilenceTimeout = 15
|
||||
|
Loading…
Reference in New Issue
Block a user