From 372e773c124c9d7c0d9a3f96b74d6c7b245abfa5 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 1 Dec 2021 11:01:53 +0100 Subject: [PATCH] Rename to check-operating-system.ps1 and check-uptime.ps1 --- Docs/VoiceControl.md | 4 +--- Scripts/check-health.ps1 | 5 ++-- ...-system.ps1 => check-operating-system.ps1} | 14 +++++------ Scripts/{tell-uptime.ps1 => check-uptime.ps1} | 23 +++++++++---------- 4 files changed, 22 insertions(+), 24 deletions(-) rename Scripts/{tell-operating-system.ps1 => check-operating-system.ps1} (60%) rename Scripts/{tell-uptime.ps1 => check-uptime.ps1} (66%) diff --git a/Docs/VoiceControl.md b/Docs/VoiceControl.md index e96c9f23..05c06264 100644 --- a/Docs/VoiceControl.md +++ b/Docs/VoiceControl.md @@ -97,7 +97,7 @@ Computer, open `name` settings Computer, check `name` ---------------------- * let the computer check something. -* replace `name` by: "CPU", "DNS", "ping", or "swap space" +* replace `name` by: "CPU", "DNS", "operating system", "ping", "swap space", or "up-time". 🔊 Audio @@ -113,8 +113,6 @@ Computer, check `name` * *Computer, locate my phone.* * *Computer, tell joke.* * *Computer, tell quote.* -* *Computer, tell operating system.* -* *Computer, tell up-time.* 💬 Nice Conversation diff --git a/Scripts/check-health.ps1 b/Scripts/check-health.ps1 index 5e08d024..11ab309a 100755 --- a/Scripts/check-health.ps1 +++ b/Scripts/check-health.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - Checks the health of the local computer + Checks the computer health .DESCRIPTION This script checks the health of the local computer. .EXAMPLE @@ -10,7 +10,6 @@ ✔️ 30.3 °C CPU temperature - good ✔️ DNS resolution is 19.7 domains per second ✔️ 29 ms ping average (13 ms min, 110 ms max, 10 hosts) - ✔️ Windmill is healthy .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -18,6 +17,8 @@ License: CC0 #> +& "$PSScriptRoot/check-uptime.ps1" +& "$PSScriptRoot/check-operating-system.ps1" & "$PSScriptRoot/check-swap-space.ps1" if ($lastExitCode -ne "0") { $Healthy = 0 } diff --git a/Scripts/tell-operating-system.ps1 b/Scripts/check-operating-system.ps1 similarity index 60% rename from Scripts/tell-operating-system.ps1 rename to Scripts/check-operating-system.ps1 index ae8e6398..3d52cd56 100755 --- a/Scripts/tell-operating-system.ps1 +++ b/Scripts/check-operating-system.ps1 @@ -1,10 +1,10 @@ <# .SYNOPSIS - Tells the OS version by text-to-speech + Determines the exact OS version .DESCRIPTION - This script speaks the operating system version by text-to-speech (TTS). + This script determines and says the exact operating system version by text-to-speech (TTS). .EXAMPLE - PS> ./tell-operating-system + PS> ./check-operating-system .NOTES Author: Markus Fleschutz · License: CC0 .LINK @@ -13,16 +13,16 @@ try { if ($IsLinux) { - $Answer = (uname -sr) + $Reply = (uname -sr) } else { $OS = Get-WmiObject -class Win32_OperatingSystem $OSname = $OS.Caption $OSarchitecture = $OS.OSArchitecture $OSversion = $OS.Version - $Answer = "$OSname for $OSarchitecture version $OSversion" + $Reply = "$OSname for $OSarchitecture version $OSversion" } - & "$PSScriptRoot/speak-english.ps1" "$Answer" - write-output "$Answer" + "✔️ $Reply" + & "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/tell-uptime.ps1 b/Scripts/check-uptime.ps1 similarity index 66% rename from Scripts/tell-uptime.ps1 rename to Scripts/check-uptime.ps1 index e70ad429..74a17222 100755 --- a/Scripts/tell-uptime.ps1 +++ b/Scripts/check-uptime.ps1 @@ -1,10 +1,10 @@ <# .SYNOPSIS - Tells the uptime by text-to-speech + Determines the uptime .DESCRIPTION - This script speaks the uptime version by text-to-speech (TTS). + This script determines and says the uptime by text-to-speech (TTS). .EXAMPLE - PS> ./tell-uptime + PS> ./check-uptime .NOTES Author: Markus Fleschutz · License: CC0 .LINK @@ -25,23 +25,22 @@ try { $Minutes = $Uptime.Minutes if ($Days -eq "1") { - $Answer = "I'm up for 1 day, " + $Reply = "Up for 1 day, " } else { - $Answer = "I'm up for $Days days, " + $Reply = "Up for $Days days, " } if ($Hours -eq "1") { - $Answer += "1 hour " + $Reply += "1 hour " } else { - $Answer += "$Hours hours " + $Reply += "$Hours hours " } if ($Minutes -eq "1") { - $Answer += "and 1 minute." + $Reply += "and 1 minute." } else { - $Answer += "and $Minutes minutes." + $Reply += "and $Minutes minutes." } - - & "$PSScriptRoot/speak-english.ps1" "$Answer" - write-output "$Answer" + "✔️ $Reply" + & "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"