From 0ced649ed101a2a16e6da39d111a41e375b8a689 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 22 Nov 2022 13:05:00 +0100 Subject: [PATCH] Remove unused give-reply.ps1 and repeat-last-reply.ps1 --- Scripts/give-reply.ps1 | 39 ----------------------------------- Scripts/repeat-last-reply.ps1 | 29 -------------------------- 2 files changed, 68 deletions(-) delete mode 100755 Scripts/give-reply.ps1 delete mode 100755 Scripts/repeat-last-reply.ps1 diff --git a/Scripts/give-reply.ps1 b/Scripts/give-reply.ps1 deleted file mode 100755 index 187d2769..00000000 --- a/Scripts/give-reply.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -<# -.SYNOPSIS - Gives a reply -.DESCRIPTION - This PowerShell script gives a reply in English on the console and by text-to-speech (TTS). -.PARAMETER text - Specifies the text to speak -.EXAMPLE - PS> ./give-reply "Hello World" -.LINK - https://github.com/fleschutz/PowerShell -.NOTES - Author: Markus Fleschutz | License: CC0 -#> - -param([string]$text = "") - -function GetTempDir { - if ("$env:TEMP" -ne "") { return "$env:TEMP" } - if ("$env:TMP" -ne "") { return "$env:TMP" } - if ($IsLinux) { return "/tmp" } - return "C:\Temp" -} - -try { - Write-Host '“'$text' ”' # to write the reply on the console - if (!$IsLinux) { - $TTS = New-Object -ComObject SAPI.SPVoice - foreach($Voice in $TTS.GetVoices()) { - if ($Voice.GetDescription() -like "*- English*") { $TTS.Voice = $Voice } - } - [void]$TTS.Speak($text) - } - "$text" > "$(GetTempDir)/last_reply_given.txt" # to remember last reply - exit 0 # success -} catch { - "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" - exit 1 -} \ No newline at end of file diff --git a/Scripts/repeat-last-reply.ps1 b/Scripts/repeat-last-reply.ps1 deleted file mode 100755 index 7912bb1b..00000000 --- a/Scripts/repeat-last-reply.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -<# -.SYNOPSIS - Repeats the last reply -.DESCRIPTION - This PowerShell script repeats the last reply by text-to-speech (TTS). -.EXAMPLE - PS> ./repeat-last-reply -.LINK - https://github.com/fleschutz/PowerShell -.NOTES - Author: Markus Fleschutz | License: CC0 -#> - -function GetTempDir { - if ("$env:TEMP" -ne "") { return "$env:TEMP" } - if ("$env:TMP" -ne "") { return "$env:TMP" } - if ($IsLinux) { return "/tmp" } - return "C:\Temp" -} - -if (test-path "$(GetTempDir)/last_reply_given.txt" -pathType leaf) { - $Reply = "It was: " - $Reply += Get-Content "$(GetTempDir)/last_reply_given.txt" -} else { - $Reply = "Sorry, I can't remember." -} - -& "$PSScriptRoot/give-reply.ps1" "$Reply" -exit 0 # success