mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 12:41:46 +02:00
Add check-week.ps1 and check-year.ps1
This commit is contained in:
22
Scripts/check-week.ps1
Normal file
22
Scripts/check-week.ps1
Normal file
@ -0,0 +1,22 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Determines the week number
|
||||
.DESCRIPTION
|
||||
This script determines and speaks the current week number by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./check-week
|
||||
✔️ It's week #4.
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
try {
|
||||
$WeekNo = (get-date -UFormat %V)
|
||||
& "$PSScriptRoot/give-reply.ps1" "It's week #$WeekNo."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
22
Scripts/check-year.ps1
Normal file
22
Scripts/check-year.ps1
Normal file
@ -0,0 +1,22 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Determines the current year
|
||||
.DESCRIPTION
|
||||
This script determines and speaks the current year by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./check-year
|
||||
✔️ It's 2021.
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
try {
|
||||
$Year = (Get-Date).Year
|
||||
& "$PSScriptRoot/give-reply.ps1" "It's $Year."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
@ -37,7 +37,7 @@ try {
|
||||
foreach ($Script in $Scripts) {
|
||||
$ScriptName = $Script.basename
|
||||
$Keyword = $ScriptName -replace "-"," "
|
||||
"serenade.global().command(`"$($WakeWord.toLower()) $Keyword`",async(api)=>{await api.focusApplication(`"$Application`");await api.typeText(`"$ScriptName.ps1`");await api.pressKey(`"return`");});" | Add-Content "$TargetFile"
|
||||
"serenade.global().command(`"$($WakeWord.toLower()) $Keyword`",async(api)=>{await api.focusApplication(`"$Application`");await api.pressKey(`"return`");await api.typeText(`"$ScriptName.ps1`");await api.pressKey(`"return`");});" | Add-Content "$TargetFile"
|
||||
}
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
|
@ -11,7 +11,7 @@
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
$Reply = "Good night to you, too.", "Good night to you, my friend.", "Have a good night. Sleep well.", "Good night and sweet dreams." | Get-Random
|
||||
$Reply = "Good night to you too.", "Good night to you my friend.", "Have a good night. Sleep well.", "Good night and sweet dreams." | Get-Random
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
|
Reference in New Issue
Block a user