Add check-christmas.ps1 and check-new-year.ps1

This commit is contained in:
Markus Fleschutz
2021-12-04 17:28:17 +01:00
parent 3e72ee7e3c
commit 42ef987d69
3 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,25 @@
<#
.SYNOPSIS
Checks the time until New Year
.DESCRIPTION
This script checks the time until New Year and replies by text-to-speech (TTS).
.EXAMPLE
PS> ./check-new-year
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Now = [DateTime]::Now
$Diff = [Datetime]("12/31/" + $Now.Year) $Now
$Reply = "$($Diff.Days) days until New Year."
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}