mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-17 04:00:46 +01:00
Update give-reply.ps1 and repeat-last-reply.ps1
This commit is contained in:
parent
dedaad01bf
commit
f5edb4f370
@ -20,17 +20,16 @@ try {
|
|||||||
" ← $text"
|
" ← $text"
|
||||||
|
|
||||||
# speak by text-to-speech (TTS):
|
# speak by text-to-speech (TTS):
|
||||||
|
if (!$IsLinux) {
|
||||||
$TTSVoice = New-Object -ComObject SAPI.SPVoice
|
$TTSVoice = New-Object -ComObject SAPI.SPVoice
|
||||||
foreach ($Voice in $TTSVoice.GetVoices()) {
|
foreach ($Voice in $TTSVoice.GetVoices()) {
|
||||||
if ($Voice.GetDescription() -like "*- English*") {
|
if ($Voice.GetDescription() -like "*- English*") { $TTSVoice.Voice = $Voice }
|
||||||
$TTSVoice.Voice = $Voice
|
|
||||||
[void]$TTSVoice.Speak($text)
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
[void]$TTSVoice.Speak($text)
|
||||||
}
|
}
|
||||||
|
|
||||||
# remember last reply:
|
# remember last reply:
|
||||||
"$text" > "$HOME/.last_reply.txt"
|
"$text" > "$env:TEMP/last_reply.txt"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
#>
|
#>
|
||||||
|
|
||||||
if (test-path "$HOME/.last_reply.txt" -pathType leaf) {
|
if (test-path "$env:TEMP/last_reply.txt" -pathType leaf) {
|
||||||
$Reply = "It was: "
|
$Reply = "It was: "
|
||||||
$Reply += Get-Content "$HOME/.last_reply.txt"
|
$Reply += Get-Content "$env:TEMP/.last_reply.txt"
|
||||||
} else {
|
} else {
|
||||||
$Reply = "Sorry, I can't remember."
|
$Reply = "Sorry, I can't remember."
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user