diff --git a/Scripts/check-bitcoin.ps1 b/Scripts/check-bitcoin.ps1 index 49327e3d..e0070253 100644 --- a/Scripts/check-bitcoin.ps1 +++ b/Scripts/check-bitcoin.ps1 @@ -13,9 +13,8 @@ try { $Rates = (Invoke-WebRequest -uri "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,EUR" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json - $Reply = "Bitcoin is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "Bitcoin is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-christmas.ps1 b/Scripts/check-christmas.ps1 index 1426161f..e253aa35 100644 --- a/Scripts/check-christmas.ps1 +++ b/Scripts/check-christmas.ps1 @@ -15,9 +15,7 @@ try { $Now = [DateTime]::Now $Diff = [Datetime]("12/25/" + $Now.Year) – $Now - $Reply = "Christmas is in $($Diff.Days) days." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "Christmas is in $($Diff.Days) days." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-cpu.ps1 b/Scripts/check-cpu.ps1 index b7637379..772d6a6e 100755 --- a/Scripts/check-cpu.ps1 +++ b/Scripts/check-cpu.ps1 @@ -33,8 +33,8 @@ try { } else { $Reply = "$($Temp)°C CPU temperature, that's too low!" } - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-date.ps1 b/Scripts/check-date.ps1 index 383bd99a..3d0bb690 100755 --- a/Scripts/check-date.ps1 +++ b/Scripts/check-date.ps1 @@ -16,9 +16,8 @@ try { [system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US" $Weekday = (Get-Date -format "dddd") $CurrentDate = (Get-Date).ToShortDateString() - $Reply = "It's $Weekday, $CurrentDate" - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "It's $Weekday, $CurrentDate" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-dawn.ps1 b/Scripts/check-dawn.ps1 index fb063823..04352f29 100644 --- a/Scripts/check-dawn.ps1 +++ b/Scripts/check-dawn.ps1 @@ -13,8 +13,8 @@ try { $Reply = (Invoke-WebRequest http://wttr.in/?format="Dawn is at %D." -UserAgent "curl" -useBasicParsing).Content - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-dns.ps1 b/Scripts/check-dns.ps1 index d2c6c99b..9a5e9265 100755 --- a/Scripts/check-dns.ps1 +++ b/Scripts/check-dns.ps1 @@ -31,9 +31,8 @@ try { [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds $Average = [math]::round($Count / $Elapsed, 1) - $Reply = "$Average domains per second DNS resolution" - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "$Average domains per second DNS resolution" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-dogecoin.ps1 b/Scripts/check-dogecoin.ps1 index 852d1bf9..9e30af05 100644 --- a/Scripts/check-dogecoin.ps1 +++ b/Scripts/check-dogecoin.ps1 @@ -13,9 +13,8 @@ try { $Rates = (Invoke-WebRequest -uri "https://min-api.cryptocompare.com/data/price?fsym=DOGE&tsyms=USD,EUR" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json - $Reply = "Dogecoin is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "Dogecoin is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-drive-space.ps1 b/Scripts/check-drive-space.ps1 index c0c1ff7a..0c673604 100755 --- a/Scripts/check-drive-space.ps1 +++ b/Scripts/check-drive-space.ps1 @@ -30,7 +30,8 @@ try { write-warning "Drive $Drive has only $Free GB left to use! ($Used of $Total GB used, minimum is $MinLevel GB)" exit 1 } - "✔️ Drive $Drive has $Free GB left ($Total GB total)" + + & "$PSScriptRoot/give-reply.ps1" "Drive $Drive has $Free GB left ($Total GB total)" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-drives.ps1 b/Scripts/check-drives.ps1 index dacf57dd..2ccac48a 100755 --- a/Scripts/check-drives.ps1 +++ b/Scripts/check-drives.ps1 @@ -29,8 +29,7 @@ try { } else { $Reply = "Drive $($Drive.Name) has $($Free)GB left ($($Total)GB total)" } - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" } exit 0 # success } catch { diff --git a/Scripts/check-dusk.ps1 b/Scripts/check-dusk.ps1 index b3d37325..316c7656 100644 --- a/Scripts/check-dusk.ps1 +++ b/Scripts/check-dusk.ps1 @@ -13,8 +13,8 @@ try { $Reply = (Invoke-WebRequest http://wttr.in/?format="Dusk is at %d." -UserAgent "curl" -useBasicParsing).Content - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-earth.ps1 b/Scripts/check-earth.ps1 index c0f9f31c..20b4009c 100755 --- a/Scripts/check-earth.ps1 +++ b/Scripts/check-earth.ps1 @@ -12,9 +12,7 @@ #> try { - $Reply = "Earth still spins with 1040mph." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/speak-english.ps1" "Earth still spins with 1040mph." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-ethereum.ps1 b/Scripts/check-ethereum.ps1 index 81f4aa0c..0fa5cd19 100644 --- a/Scripts/check-ethereum.ps1 +++ b/Scripts/check-ethereum.ps1 @@ -13,9 +13,8 @@ try { $Rates = (Invoke-WebRequest -uri "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json - $Reply = "Ethereum is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "Ethereum is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-file-system.ps1 b/Scripts/check-file-system.ps1 index 34b3b1ea..24c8e36a 100755 --- a/Scripts/check-file-system.ps1 +++ b/Scripts/check-file-system.ps1 @@ -24,7 +24,7 @@ try { $Result = repair-volume -driveLetter $Drive -scan if ($Result -ne "NoErrorsFound") { throw "'repair-volume' failed" } - "✔️ file system on drive $Drive is clean" + & "$PSScriptRoot/give-reply.ps1" "File system on drive $Drive is clean." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-headlines.ps1 b/Scripts/check-headlines.ps1 index f37a1d74..c255b728 100644 --- a/Scripts/check-headlines.ps1 +++ b/Scripts/check-headlines.ps1 @@ -21,8 +21,7 @@ try { [xml]$Content = (invoke-webRequest -uri $RSS_URL -useBasicParsing).Content [int]$Count = 0 foreach ($item in $Content.rss.channel.item) { - "→ $($item.title)" - & "$PSScriptRoot/speak-english.ps1" "$($item.title)" + & "$PSScriptRoot/give-reply.ps1" "$($item.title)" $Count++ if ($Count -eq $MaxCount) { break } } diff --git a/Scripts/check-iss.ps1 b/Scripts/check-iss.ps1 index 419bd047..9fccac55 100644 --- a/Scripts/check-iss.ps1 +++ b/Scripts/check-iss.ps1 @@ -14,9 +14,7 @@ try { $ISS = (Invoke-WebRequest "http://api.open-notify.org/iss-now.json" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json - $Reply = "ISS is at $($ISS.iss_position.longitude)° longitude, $($ISS.iss_position.latitude)° latitude." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "ISS is at $($ISS.iss_position.longitude)° longitude, $($ISS.iss_position.latitude)° latitude." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-moon-phase.ps1 b/Scripts/check-moon-phase.ps1 index 1cc0fc4b..5808b64a 100644 --- a/Scripts/check-moon-phase.ps1 +++ b/Scripts/check-moon-phase.ps1 @@ -35,8 +35,7 @@ try { } else { $Reply += ", last new moon was $MoonAge days ago" } - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-my-balance.ps1 b/Scripts/check-my-balance.ps1 index 7402284f..ef7b7fce 100644 --- a/Scripts/check-my-balance.ps1 +++ b/Scripts/check-my-balance.ps1 @@ -11,12 +11,5 @@ https://github.com/fleschutz/PowerShell #> -try { - $Reply = "OK, what's your account number?" - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" - exit 0 # success -} catch { - "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" - exit 1 -} +& "$PSScriptRoot/give-reply.ps1" "OK, what's your account number?" +exit 0 # success diff --git a/Scripts/check-new-year.ps1 b/Scripts/check-new-year.ps1 index a87ee5df..4e795f2a 100644 --- a/Scripts/check-new-year.ps1 +++ b/Scripts/check-new-year.ps1 @@ -15,9 +15,7 @@ try { $Now = [DateTime]::Now $Diff = [Datetime]("12/31/" + $Now.Year) – $Now - $Reply = "New Year is in $($Diff.Days) days." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "New Year is in $($Diff.Days) days." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-operating-system.ps1 b/Scripts/check-operating-system.ps1 index 3d52cd56..08c5c21c 100755 --- a/Scripts/check-operating-system.ps1 +++ b/Scripts/check-operating-system.ps1 @@ -21,8 +21,7 @@ try { $OSversion = $OS.Version $Reply = "$OSname for $OSarchitecture version $OSversion" } - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-ping.ps1 b/Scripts/check-ping.ps1 index bb89e983..96854112 100755 --- a/Scripts/check-ping.ps1 +++ b/Scripts/check-ping.ps1 @@ -37,9 +37,7 @@ try { } $Avg = $Avg / $Pings.count - $Reply = "$($Avg)ms average ping time ($($Min)ms min, $($Max)ms max)" - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$($Avg)ms average ping time ($($Min)ms min, $($Max)ms max)" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-sunrise.ps1 b/Scripts/check-sunrise.ps1 index 9ddc363f..f059ec31 100644 --- a/Scripts/check-sunrise.ps1 +++ b/Scripts/check-sunrise.ps1 @@ -13,8 +13,7 @@ try { $Reply = (Invoke-WebRequest http://wttr.in/?format="Sunrise is at %S." -UserAgent "curl" -useBasicParsing).Content - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-sunset.ps1 b/Scripts/check-sunset.ps1 index b7bc4537..57303a08 100644 --- a/Scripts/check-sunset.ps1 +++ b/Scripts/check-sunset.ps1 @@ -13,8 +13,7 @@ try { $Reply = (Invoke-WebRequest http://wttr.in/?format="Sunset is at %s." -UserAgent "curl" -useBasicParsing).Content - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-swap-space.ps1 b/Scripts/check-swap-space.ps1 index c3f3ba4d..8b4015c1 100755 --- a/Scripts/check-swap-space.ps1 +++ b/Scripts/check-swap-space.ps1 @@ -38,8 +38,7 @@ try { } else { $Reply = "Swap space has $Free GB left ($Total GB total)" } - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-time-zone.ps1 b/Scripts/check-time-zone.ps1 index 8ef720e3..3d271549 100755 --- a/Scripts/check-time-zone.ps1 +++ b/Scripts/check-time-zone.ps1 @@ -13,9 +13,8 @@ try { $TimeZone = (Get-Timezone) - $Reply = "It's $($TimeZone.DisplayName)" - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "It's $($TimeZone.DisplayName)" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-time.ps1 b/Scripts/check-time.ps1 index f9d7f43e..7a002ec2 100755 --- a/Scripts/check-time.ps1 +++ b/Scripts/check-time.ps1 @@ -14,9 +14,8 @@ try { [system.threading.thread]::currentThread.currentCulture=[system.globalization.cultureInfo]"en-US" $CurrentTime = $((Get-Date).ToShortTimeString()) - $Reply = "It's $CurrentTime" - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + + & "$PSScriptRoot/give-reply.ps1" "It's $CurrentTime" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-uptime.ps1 b/Scripts/check-uptime.ps1 index 83936015..018d60f9 100755 --- a/Scripts/check-uptime.ps1 +++ b/Scripts/check-uptime.ps1 @@ -41,8 +41,7 @@ try { $Reply += "and $Minutes minutes" } $Reply += "." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-vpn.ps1 b/Scripts/check-vpn.ps1 index 0b7d9a20..74abb055 100755 --- a/Scripts/check-vpn.ps1 +++ b/Scripts/check-vpn.ps1 @@ -20,8 +20,7 @@ try { } if ("$Reply" -eq "") { $Reply = "No VPN connection available" } - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-weather.ps1 b/Scripts/check-weather.ps1 index dbc16df3..d842a6b5 100755 --- a/Scripts/check-weather.ps1 +++ b/Scripts/check-weather.ps1 @@ -31,9 +31,7 @@ try { $Area = $Weather.nearest_area.areaName.value $Region = $Weather.nearest_area.region.value - $Reply = "$($Temp)°C, $($Precip)mm rain, $($Humidity)% humidity, $($WindSpeed)km/h wind from $WindDir with $($Clouds)% clouds and $($Visib)km visibility at $Area ($Region)." - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$($Temp)°C, $($Precip)mm rain, $($Humidity)% humidity, $($WindSpeed)km/h wind from $WindDir with $($Clouds)% clouds and $($Visib)km visibility at $Area ($Region)." exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-zenith.ps1 b/Scripts/check-zenith.ps1 index 747b6289..1eccf000 100644 --- a/Scripts/check-zenith.ps1 +++ b/Scripts/check-zenith.ps1 @@ -13,8 +13,7 @@ try { $Reply = (Invoke-WebRequest http://wttr.in/?format="Zenith is at %z." -UserAgent "curl" -useBasicParsing).Content - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" + & "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/give-reply.ps1 b/Scripts/give-reply.ps1 index 8b9c46a8..e4874f55 100644 --- a/Scripts/give-reply.ps1 +++ b/Scripts/give-reply.ps1 @@ -2,7 +2,7 @@ .SYNOPSIS Gives a reply .DESCRIPTION - This script gives a reply in English by text-to-speech (TTS). + This script gives a reply in English on the console and by text-to-speech (TTS). .PARAMETER text Specifies the text to speak .EXAMPLE @@ -16,16 +16,21 @@ param([string]$text = "") try { - "📣$text" + # print reply on the console: + "→ $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) - exit 0 # success + break } } + + # remember last reply: + "$text" > "$HOME/.last_reply.txt" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/good-bye.ps1 b/Scripts/good-bye.ps1 index 465bb28c..56ac4936 100644 --- a/Scripts/good-bye.ps1 +++ b/Scripts/good-bye.ps1 @@ -1,8 +1,8 @@ <# .SYNOPSIS - Answers to 'good bye' + Replies to 'good bye' .DESCRIPTION - This script says a reply to "good bye" by text-to-speech (TTS). + This script says a reply to 'good bye' by text-to-speech (TTS). .EXAMPLE PS> ./good-bye .NOTES @@ -13,6 +13,5 @@ $Reply = "Good bye.", "See you.", "Bye bye." | Get-Random -"$Reply" -& "$PSScriptRoot/speak-english.ps1" "$Reply" +& "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success diff --git a/Scripts/good-evening.ps1 b/Scripts/good-evening.ps1 index 4c3ddb37..feeff0df 100644 --- a/Scripts/good-evening.ps1 +++ b/Scripts/good-evening.ps1 @@ -1,8 +1,8 @@ <# .SYNOPSIS - Answers to 'good evening' + Replies to 'good evening' .DESCRIPTION - This script says a reply to "good evening" by text-to-speech (TTS). + This script says a reply to 'good evening' by text-to-speech (TTS). .EXAMPLE PS> ./good-evening .NOTES @@ -13,6 +13,5 @@ $Reply = "And a special good evening to you too." -"$Reply" -& "$PSScriptRoot/speak-english.ps1" "$Reply" +& "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success diff --git a/Scripts/good-morning.ps1 b/Scripts/good-morning.ps1 index cec87093..9407d9b6 100755 --- a/Scripts/good-morning.ps1 +++ b/Scripts/good-morning.ps1 @@ -13,6 +13,5 @@ $Reply = "Good morning.", "Good morning to you too.", "Well, good morning to you too.", "Good morning! How are you?", "Morning." | Get-Random -"$Reply" -& "$PSScriptRoot/speak-english.ps1" "$Reply" +& "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success diff --git a/Scripts/good-night.ps1 b/Scripts/good-night.ps1 index 59e879e0..479f5752 100644 --- a/Scripts/good-night.ps1 +++ b/Scripts/good-night.ps1 @@ -1,8 +1,8 @@ <# .SYNOPSIS - Answers to 'good night' + Replies to 'good night' .DESCRIPTION - This script says a reply to "good night" by text-to-speech (TTS). + This script says a reply to 'good night' by text-to-speech (TTS). .EXAMPLE PS> ./good-night .NOTES @@ -13,6 +13,5 @@ $Reply = "Good night to you, too.", "Good night to you, my friend.", "Have a good night. Sleep well.", "Good night and sweet dreams." | Get-Random -"$Reply" -& "$PSScriptRoot/speak-english.ps1" "$Reply" +& "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success diff --git a/Scripts/hi.ps1 b/Scripts/hi.ps1 index 523887f3..9c3d5008 100644 --- a/Scripts/hi.ps1 +++ b/Scripts/hi.ps1 @@ -2,7 +2,7 @@ .SYNOPSIS Replies to "Hi" .DESCRIPTION - This script replies to "Hi" by text-to-speech (TTS). + This script replies to 'Hi' by text-to-speech (TTS). .EXAMPLE PS> ./hi .NOTES @@ -11,12 +11,7 @@ https://github.com/fleschutz/PowerShell #> -try { - $Reply = "Hello, how can I help?" - "✔️ $Reply" - & "$PSScriptRoot/speak-english.ps1" "$Reply" - exit 0 # success -} catch { - "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" - exit 1 -} +$Reply = "Hello, how can I help?" + +& "$PSScriptRoot/give-reply.ps1" "$Reply" +exit 0 # success diff --git a/Scripts/i-will-be-back.ps1 b/Scripts/i-will-be-back.ps1 index 10cc9c4c..9bca60fc 100755 --- a/Scripts/i-will-be-back.ps1 +++ b/Scripts/i-will-be-back.ps1 @@ -1,8 +1,8 @@ <# .SYNOPSIS - Answers 'I'll be back' + Replies to 'I'll be back' .DESCRIPTION - This script answers "I'll be back" by text-to-speech (TTS). + This script replies to "I'll be back" by text-to-speech (TTS). .EXAMPLE PS> ./i-will-be-back .NOTES @@ -11,8 +11,7 @@ https://github.com/fleschutz/PowerShell #> -$Answer = "Hasta la vista, baby." +$Reply = "Hasta la vista, baby." -& "$PSScriptRoot/speak-english.ps1" "$Answer" -write-output "$Answer" +& "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success diff --git a/Scripts/thank-you.ps1 b/Scripts/thank-you.ps1 index 73988d10..bf300720 100755 --- a/Scripts/thank-you.ps1 +++ b/Scripts/thank-you.ps1 @@ -1,8 +1,8 @@ <# .SYNOPSIS - Say an answer to 'thank you' + Replies to 'thank you' .DESCRIPTION - This script answers to "thank you" by text-to-speech (TTS). + This script replies to 'thank you' by text-to-speech (TTS). .EXAMPLE PS> ./thank-you .NOTES @@ -11,8 +11,7 @@ https://github.com/fleschutz/PowerShell #> -$Answer = "It's a pleasure.", "Never mind." | Get-Random +$Reply = "It's a pleasure.", "Never mind.", "Pleasure is mine." | Get-Random -& "$PSScriptRoot/speak-english.ps1" "$Answer" -write-output "$Answer" +& "$PSScriptRoot/give-reply.ps1" "$Reply" exit 0 # success diff --git a/Scripts/what-is.ps1 b/Scripts/what-is.ps1 index 9f329aa3..721c14b5 100755 --- a/Scripts/what-is.ps1 +++ b/Scripts/what-is.ps1 @@ -16,8 +16,7 @@ param([string]$abbreviation = "") function Reply { param([string]$Text) - "$Text" - & "$PSScriptRoot/speak-english.ps1" "$Text" + & "$PSScriptRoot/give-reply.ps1" "$Text" } try { @@ -31,7 +30,7 @@ try { foreach($Row in $Table) { if ($Row.Abbreviation -eq $abbreviation) { $Basename = (get-item "$File").Basename - Reply " - $($Row.Definition) ($($Row.Abbreviation)) in $Basename" + Reply "$($Row.Definition) ($($Row.Abbreviation)) in $Basename" $FoundOne = $true } }