From 70422aaeb0887ca9e848e8c300dff52a57fed69d Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sat, 4 Dec 2021 17:51:31 +0100 Subject: [PATCH] Add check-iss.ps1 --- Docs/VoiceControl.md | 2 +- Scripts/check-iss.ps1 | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Scripts/check-iss.ps1 diff --git a/Docs/VoiceControl.md b/Docs/VoiceControl.md index f54fda71..c54ecd80 100644 --- a/Docs/VoiceControl.md +++ b/Docs/VoiceControl.md @@ -25,7 +25,7 @@ More supported voice commands are: `Computer, check` [name] ------------------------ -Lets the computer check something, replace [name] by: `Christmas`, `CPU`, `date`, `DNS`, `drives`, `Earth` (fun), `headlines`, `Moon`, `New Year`, `operating system`, `ping`, `Sun`, `swap space`, `time`, `time zone`, `up-time`, `VPN`, or `weather`. +Lets the computer check something, replace [name] by: `Christmas`, `CPU`, `date`, `DNS`, `drives`, `Earth` (fun), `headlines`, `ISS`, `Moon`, `New Year`, `operating system`, `ping`, `Sun`, `swap space`, `time`, `time zone`, `up-time`, `VPN`, or `weather`. `Computer, open` [name] `browser` diff --git a/Scripts/check-iss.ps1 b/Scripts/check-iss.ps1 new file mode 100644 index 00000000..419bd047 --- /dev/null +++ b/Scripts/check-iss.ps1 @@ -0,0 +1,24 @@ +<# +.SYNOPSIS + Checks the ISS +.DESCRIPTION + This script checks the International Space Station (ISS) and report the position by text-to-speech (TTS). +.EXAMPLE + PS> ./check-iss +.LINK + https://github.com/fleschutz/PowerShell +.NOTES + Author: Markus Fleschutz · License: CC0 +#> + +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" + exit 0 # success +} catch { + "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" + exit 1 +}