From f5edb4f3705fca6d2f4d228385f96e760d9bb1c1 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 9 Dec 2021 09:42:54 +0100 Subject: [PATCH] Update give-reply.ps1 and repeat-last-reply.ps1 --- Scripts/give-reply.ps1 | 13 ++++++------- Scripts/repeat-last-reply.ps1 | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Scripts/give-reply.ps1 b/Scripts/give-reply.ps1 index 693decad..409e397a 100644 --- a/Scripts/give-reply.ps1 +++ b/Scripts/give-reply.ps1 @@ -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))" diff --git a/Scripts/repeat-last-reply.ps1 b/Scripts/repeat-last-reply.ps1 index 7c37e1ce..8ba4c81c 100644 --- a/Scripts/repeat-last-reply.ps1 +++ b/Scripts/repeat-last-reply.ps1 @@ -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." }