Add some check-*.ps1 scripts

This commit is contained in:
Markus Fleschutz 2021-12-05 11:28:14 +01:00
parent 70422aaeb0
commit ea7512c1c0
7 changed files with 96 additions and 8 deletions

View File

@ -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`, `ISS`, `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`, `dawn`, `drives`, `dusk`, `Earth` (fun), `headlines`, `ISS`, `Moon`, `New Year`, `operating system`, `ping`, `sunrise`, `sunset`, `swap space`, `time`, `time zone`, `up-time`, `VPN`, `weather`, or `zenith`.
`Computer, open` [name] `browser`

View File

@ -1,10 +1,10 @@
<#
.SYNOPSIS
Checks the sun
Checks the time of dawn
.DESCRIPTION
This script determines Sun details and answers by text-to-speech (TTS).
This script queries the time of dawn and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-sun
PS> ./check-dawn
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
@ -12,7 +12,7 @@
#>
try {
$Reply = (Invoke-WebRequest http://wttr.in/?format="Dawn is at %D, sunrise at %S, zenith at %z, sunset at %s, dusk at %d" -UserAgent "curl" -useBasicParsing).Content
$Reply = (Invoke-WebRequest http://wttr.in/?format="Dawn is at %D." -UserAgent "curl" -useBasicParsing).Content
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success

22
Scripts/check-dusk.ps1 Normal file
View File

@ -0,0 +1,22 @@
<#
.SYNOPSIS
Checks the time of dusk
.DESCRIPTION
This script queries the time of dusk and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-dusk
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Reply = (Invoke-WebRequest http://wttr.in/?format="Dusk is at %d." -UserAgent "curl" -useBasicParsing).Content
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}

View File

@ -1,10 +1,10 @@
<#
.SYNOPSIS
Checks the moon
Checks the moon phase
.DESCRIPTION
This script determines moon details and answers by text-to-speech (TTS).
This script determines the moon phase and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-moon
PS> ./check-moon-phase
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK

22
Scripts/check-sunrise.ps1 Normal file
View File

@ -0,0 +1,22 @@
<#
.SYNOPSIS
Checks the time of sunrise
.DESCRIPTION
This script queries the time of sunrise and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-sunrise
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Reply = (Invoke-WebRequest http://wttr.in/?format="Sunrise is at %S." -UserAgent "curl" -useBasicParsing).Content
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}

22
Scripts/check-sunset.ps1 Normal file
View File

@ -0,0 +1,22 @@
<#
.SYNOPSIS
Checks the time of sunset
.DESCRIPTION
This script queries the time of sunset and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-sunset
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Reply = (Invoke-WebRequest http://wttr.in/?format="Sunset is at %s." -UserAgent "curl" -useBasicParsing).Content
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}

22
Scripts/check-zenith.ps1 Normal file
View File

@ -0,0 +1,22 @@
<#
.SYNOPSIS
Checks the time of zenith
.DESCRIPTION
This script queries the time of zenith and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-zenith
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Reply = (Invoke-WebRequest http://wttr.in/?format="Zenith is at %z." -UserAgent "curl" -useBasicParsing).Content
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}