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