From fa7823858fc7285a2eedfdaacea6c2e29db42098 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Fri, 18 Nov 2022 16:54:04 +0100 Subject: [PATCH] Change to use speak-english.ps1 --- Scripts/change-wallpaper.ps1 | 2 +- Scripts/check-day.ps1 | 2 +- Scripts/check-drive-space.ps1 | 2 +- Scripts/check-dusk.ps1 | 2 +- Scripts/check-easter-sunday.ps1 | 4 ++-- Scripts/check-file-system.ps1 | 2 +- Scripts/check-independence-day.ps1 | 4 ++-- Scripts/check-iss-position.ps1 | 2 +- Scripts/check-midnight.ps1 | 2 +- Scripts/check-month.ps1 | 2 +- Scripts/check-moon-phase.ps1 | 2 +- Scripts/check-new-year.ps1 | 4 ++-- Scripts/check-noon.ps1 | 2 +- Scripts/check-santa.ps1 | 2 +- Scripts/check-weather.ps1 | 2 +- Scripts/check-week.ps1 | 5 ++--- Scripts/check-wind.ps1 | 2 +- Scripts/clear-recycle-bin.ps1 | 2 +- Scripts/merry-christmas.ps1 | 2 +- Scripts/open-git-extensions.ps1 | 2 +- Scripts/open-outlook.ps1 | 2 +- Scripts/open-thunderbird.ps1 | 2 +- Scripts/roll-a-dice.ps1 | 2 +- 23 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Scripts/change-wallpaper.ps1 b/Scripts/change-wallpaper.ps1 index 3d13bdcc..d973cf76 100755 --- a/Scripts/change-wallpaper.ps1 +++ b/Scripts/change-wallpaper.ps1 @@ -23,7 +23,7 @@ function GetTempDir { } try { - & "$PSScriptRoot/give-reply.ps1" "Just a second..." + & "$PSScriptRoot/speak-english.ps1" "Just a second..." $Path = "$(GetTempDir)/next_wallpaper.jpg" & wget -O $Path "https://source.unsplash.com/3840x2160?$Category" diff --git a/Scripts/check-day.ps1 b/Scripts/check-day.ps1 index 7e83109a..2d234e22 100755 --- a/Scripts/check-day.ps1 +++ b/Scripts/check-day.ps1 @@ -15,7 +15,7 @@ try { [system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US" $Weekday = (Get-Date -format "dddd") - & "$PSScriptRoot/give-reply.ps1" "It's $Weekday." + & "$PSScriptRoot/speak-english.ps1" "It's $Weekday." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-drive-space.ps1 b/Scripts/check-drive-space.ps1 index fb015445..07d0649d 100755 --- a/Scripts/check-drive-space.ps1 +++ b/Scripts/check-drive-space.ps1 @@ -31,7 +31,7 @@ try { exit 1 } - & "$PSScriptRoot/give-reply.ps1" "Drive $Drive has $Free GB left ($Total GB total)" + & "$PSScriptRoot/speak-english.ps1" "Drive $Drive has $Free GB left ($Total GB total)" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-dusk.ps1 b/Scripts/check-dusk.ps1 index 57d17ae4..53cc12c3 100755 --- a/Scripts/check-dusk.ps1 +++ b/Scripts/check-dusk.ps1 @@ -35,7 +35,7 @@ try { $TimeSpan = TimeSpanToString($Now - $Dusk) $Reply = "Dusk was $TimeSpan ago at $($Dusk.ToShortTimeString())." } - & "$PSScriptRoot/give-reply.ps1" "$Reply" + & "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-easter-sunday.ps1 b/Scripts/check-easter-sunday.ps1 index bfba3bfd..e9f8bf48 100755 --- a/Scripts/check-easter-sunday.ps1 +++ b/Scripts/check-easter-sunday.ps1 @@ -16,10 +16,10 @@ try { $Easter = [Datetime]("04/17/2022") if ($Now -lt $Easter) { $Diff = $Easter – $Now - & "$PSScriptRoot/give-reply.ps1" "Easter Sunday on April 17 is in $($Diff.Days) days." + & "$PSScriptRoot/speak-english.ps1" "Easter Sunday on April 17 is in $($Diff.Days) days." } else { $Diff = $Now - $Easter - & "$PSScriptRoot/give-reply.ps1" "Easter Sunday on April 17 was $($Diff.Days) days ago." + & "$PSScriptRoot/speak-english.ps1" "Easter Sunday on April 17 was $($Diff.Days) days ago." } exit 0 # success } catch { diff --git a/Scripts/check-file-system.ps1 b/Scripts/check-file-system.ps1 index 3855ae1d..38ec0e38 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" } - & "$PSScriptRoot/give-reply.ps1" "File system on drive $Drive is clean." + & "$PSScriptRoot/speak-english.ps1" "File system on drive $Drive is clean." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-independence-day.ps1 b/Scripts/check-independence-day.ps1 index d045f4b4..fdc62f97 100755 --- a/Scripts/check-independence-day.ps1 +++ b/Scripts/check-independence-day.ps1 @@ -16,10 +16,10 @@ try { $IndependenceDay = [Datetime]("07/04/" + $Now.Year) if ($Now -lt $IndependenceDay) { $Diff = $IndependenceDay – $Now - & "$PSScriptRoot/give-reply.ps1" "Independence Day on July 4th is in $($Diff.Days) days." + & "$PSScriptRoot/speak-english.ps1" "Independence Day on July 4th is in $($Diff.Days) days." } else { $Diff = $Now - $IndependenceDay - & "$PSScriptRoot/give-reply.ps1" "Independence Day on July 4th was $($Diff.Days) days ago." + & "$PSScriptRoot/speak-english.ps1" "Independence Day on July 4th was $($Diff.Days) days ago." } exit 0 # success } catch { diff --git a/Scripts/check-iss-position.ps1 b/Scripts/check-iss-position.ps1 index 766adfc6..effb6ec9 100755 --- a/Scripts/check-iss-position.ps1 +++ b/Scripts/check-iss-position.ps1 @@ -14,7 +14,7 @@ try { $ISS = (Invoke-WebRequest "http://api.open-notify.org/iss-now.json" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json - & "$PSScriptRoot/give-reply.ps1" "The International Space Station is currently at $($ISS.iss_position.longitude)° longitude and $($ISS.iss_position.latitude)° latitude." + & "$PSScriptRoot/speak-english.ps1" "The International Space Station is currently at $($ISS.iss_position.longitude)° longitude and $($ISS.iss_position.latitude)° latitude." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-midnight.ps1 b/Scripts/check-midnight.ps1 index 07fbcc5d..e2835e51 100755 --- a/Scripts/check-midnight.ps1 +++ b/Scripts/check-midnight.ps1 @@ -33,7 +33,7 @@ try { $TimeSpan = TimeSpanToString($Midnight - $Now) $Reply = "Midnight is in $TimeSpan." } - & "$PSScriptRoot/give-reply.ps1" "$Reply" + & "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-month.ps1 b/Scripts/check-month.ps1 index ceb23380..f8e8bee7 100755 --- a/Scripts/check-month.ps1 +++ b/Scripts/check-month.ps1 @@ -15,7 +15,7 @@ try { [system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US" $MonthName = (Get-Date -UFormat %B) - & "$PSScriptRoot/give-reply.ps1" "It's $MonthName." + & "$PSScriptRoot/speak-english.ps1" "It's $MonthName." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-moon-phase.ps1 b/Scripts/check-moon-phase.ps1 index 1eee6a4d..1a00df5c 100755 --- a/Scripts/check-moon-phase.ps1 +++ b/Scripts/check-moon-phase.ps1 @@ -35,7 +35,7 @@ try { } else { $Reply += ", last new moon was $MoonAge days ago" } - & "$PSScriptRoot/give-reply.ps1" "$Reply" + & "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-new-year.ps1 b/Scripts/check-new-year.ps1 index 331c848d..73355b5a 100755 --- a/Scripts/check-new-year.ps1 +++ b/Scripts/check-new-year.ps1 @@ -16,9 +16,9 @@ try { $NewYear = [Datetime]("12/31/" + $Now.Year) $Days = ($NewYear – $Now).Days + 1 if ($Days -gt 1) { - & "$PSScriptRoot/give-reply.ps1" "New Year is in $Days days." + & "$PSScriptRoot/speak-english.ps1" "New Year is in $Days days." } elseif ($Days -eq 1) { - & "$PSScriptRoot/give-reply.ps1" "New Year is tomorrow." + & "$PSScriptRoot/speak-english.ps1" "New Year is tomorrow." } exit 0 # success } catch { diff --git a/Scripts/check-noon.ps1 b/Scripts/check-noon.ps1 index 58057319..2b613d17 100755 --- a/Scripts/check-noon.ps1 +++ b/Scripts/check-noon.ps1 @@ -32,7 +32,7 @@ try { $TimeSpan = TimeSpanToString($Now - $Noon) $Reply = "Noon was $TimeSpan ago." } - & "$PSScriptRoot/give-reply.ps1" "$Reply" + & "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-santa.ps1 b/Scripts/check-santa.ps1 index 785f1658..289f0052 100755 --- a/Scripts/check-santa.ps1 +++ b/Scripts/check-santa.ps1 @@ -15,7 +15,7 @@ try { $Now = [DateTime]::Now $Diff = [Datetime]("12/06/" + $Now.Year) – $Now - & "$PSScriptRoot/give-reply.ps1" "Saint Nicholas Day is in $($Diff.Days) days." + & "$PSScriptRoot/speak-english.ps1" "Saint Nicholas Day is in $($Diff.Days) days." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-weather.ps1 b/Scripts/check-weather.ps1 index 64089e38..b0f0d34b 100755 --- a/Scripts/check-weather.ps1 +++ b/Scripts/check-weather.ps1 @@ -31,7 +31,7 @@ try { $Area = $Weather.nearest_area.areaName.value $Region = $Weather.nearest_area.region.value - & "$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)." + & "$PSScriptRoot/speak-english.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 in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-week.ps1 b/Scripts/check-week.ps1 index f6b5602f..6bef4eff 100755 --- a/Scripts/check-week.ps1 +++ b/Scripts/check-week.ps1 @@ -5,7 +5,6 @@ This PowerShell script determines and speaks the current week number by text-to-speech (TTS). .EXAMPLE PS> ./check-week - ✔️ It's week #4. .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -13,8 +12,8 @@ #> try { - $WeekNo = (get-date -UFormat %V) - & "$PSScriptRoot/give-reply.ps1" "It's week #$WeekNo." + $WeekNo = (Get-Date -UFormat %V) + & "$PSScriptRoot/speak-english.ps1" "It's week #$WeekNo." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/check-wind.ps1 b/Scripts/check-wind.ps1 index b87ff2c2..19971533 100755 --- a/Scripts/check-wind.ps1 +++ b/Scripts/check-wind.ps1 @@ -22,7 +22,7 @@ try { $Area = $Weather.nearest_area.areaName.value $Region = $Weather.nearest_area.region.value - & "$PSScriptRoot/give-reply.ps1" "$($WindSpeed)km/h wind from $WindDir at $Area ($Region)." + & "$PSScriptRoot/speak-english.ps1" "$($WindSpeed)km/h wind from $WindDir at $Area ($Region)." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/clear-recycle-bin.ps1 b/Scripts/clear-recycle-bin.ps1 index 88234b4d..2b12e44c 100755 --- a/Scripts/clear-recycle-bin.ps1 +++ b/Scripts/clear-recycle-bin.ps1 @@ -16,7 +16,7 @@ try { Clear-RecycleBin -Confirm:$false if ($lastExitCode -ne "0") { throw "'Clear-RecycleBin' failed" } - & "$PSScriptRoot/give-reply.ps1" "It's clean now." + & "$PSScriptRoot/speak-english.ps1" "It's clean now." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/merry-christmas.ps1 b/Scripts/merry-christmas.ps1 index 1dd4ca24..4e7838e4 100755 --- a/Scripts/merry-christmas.ps1 +++ b/Scripts/merry-christmas.ps1 @@ -13,5 +13,5 @@ $Reply = "Merry Christmas to you too!", "Happy Christmas to you too!" | Get-Random -& "$PSScriptRoot/give-reply.ps1" "$Reply" +& "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success diff --git a/Scripts/open-git-extensions.ps1 b/Scripts/open-git-extensions.ps1 index 00e2e1a6..25804151 100755 --- a/Scripts/open-git-extensions.ps1 +++ b/Scripts/open-git-extensions.ps1 @@ -21,7 +21,7 @@ function TryToExec { param($Folder, $Binary) try { TryToExec "C:\Program Files (x86)\GitExtensions" "GitExtensions.exe" TryToExec "C:\Program Files\GitExtensions" "GitExtensions.exe" - & "$PSScriptRoot/give-reply.ps1" "Sorry, can't find Git Extensions." + & "$PSScriptRoot/speak-english.ps1" "Sorry, can't find Git Extensions." exit 1 } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/open-outlook.ps1 b/Scripts/open-outlook.ps1 index 0d171d9d..9bfdc199 100755 --- a/Scripts/open-outlook.ps1 +++ b/Scripts/open-outlook.ps1 @@ -23,6 +23,6 @@ try { TryToExec "C:\Programs\Microsoft Office\Office14" "OUTLOOK.EXE" throw "It seems Outlook isn't installed yet." } catch { - & "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])" + & "$PSScriptRoot/speak-english.ps1" "Sorry: $($Error[0])" exit 1 } diff --git a/Scripts/open-thunderbird.ps1 b/Scripts/open-thunderbird.ps1 index dd7968e7..6dd8c5eb 100755 --- a/Scripts/open-thunderbird.ps1 +++ b/Scripts/open-thunderbird.ps1 @@ -22,5 +22,5 @@ try { TryToExec "C:\Program Files (x86)\Mozilla Thunderbird" "thunderbird.exe" throw "It seems Thunderbird isn't installed yet." } catch { - & "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])" + & "$PSScriptRoot/speak-english.ps1" "Sorry: $($Error[0])" } diff --git a/Scripts/roll-a-dice.ps1 b/Scripts/roll-a-dice.ps1 index b8c46b07..5493abaf 100755 --- a/Scripts/roll-a-dice.ps1 +++ b/Scripts/roll-a-dice.ps1 @@ -14,5 +14,5 @@ $Reply = "It's", "I get", "Now it's", "OK, I have" | Get-Random $Number = "1", "2", "3", "4", "5", "6" | Get-Random -& "$PSScriptRoot/give-reply.ps1" "$Reply $Number." +& "$PSScriptRoot/speak-english.ps1" "$Reply $Number." exit 0 # success