PowerShell/Scripts/check-zenith.ps1

22 lines
567 B
PowerShell
Raw Normal View History

2021-12-04 14:02:56 +01:00
<#
.SYNOPSIS
2021-12-05 11:28:14 +01:00
Checks the time of zenith
2021-12-04 14:02:56 +01:00
.DESCRIPTION
2021-12-05 11:28:14 +01:00
This script queries the time of zenith and answers by text-to-speech (TTS).
2021-12-04 14:02:56 +01:00
.EXAMPLE
2021-12-05 11:28:14 +01:00
PS> ./check-zenith
2021-12-04 14:02:56 +01:00
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
2021-12-05 11:28:14 +01:00
$Reply = (Invoke-WebRequest http://wttr.in/?format="Zenith is at %z." -UserAgent "curl" -useBasicParsing).Content
2021-12-06 17:00:49 +01:00
& "$PSScriptRoot/give-reply.ps1" "$Reply"
2021-12-04 14:02:56 +01:00
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}