mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-16 19:50:45 +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"
|
||||
|
||||
# speak by text-to-speech (TTS):
|
||||
$TTSVoice = New-Object -ComObject SAPI.SPVoice
|
||||
foreach ($Voice in $TTSVoice.GetVoices()) {
|
||||
if ($Voice.GetDescription() -like "*- English*") {
|
||||
$TTSVoice.Voice = $Voice
|
||||
[void]$TTSVoice.Speak($text)
|
||||
break
|
||||
if (!$IsLinux) {
|
||||
$TTSVoice = New-Object -ComObject SAPI.SPVoice
|
||||
foreach ($Voice in $TTSVoice.GetVoices()) {
|
||||
if ($Voice.GetDescription() -like "*- English*") { $TTSVoice.Voice = $Voice }
|
||||
}
|
||||
[void]$TTSVoice.Speak($text)
|
||||
}
|
||||
|
||||
# remember last reply:
|
||||
"$text" > "$HOME/.last_reply.txt"
|
||||
"$text" > "$env:TEMP/last_reply.txt"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
@ -11,9 +11,9 @@
|
||||
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 += Get-Content "$HOME/.last_reply.txt"
|
||||
$Reply += Get-Content "$env:TEMP/.last_reply.txt"
|
||||
} else {
|
||||
$Reply = "Sorry, I can't remember."
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user