mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-24 15:49:02 +01:00
27 lines
731 B
PowerShell
Executable File
27 lines
731 B
PowerShell
Executable File
<#
|
|
.SYNOPSIS
|
|
Say the current date by text-to-speech
|
|
.DESCRIPTION
|
|
This script speaks the current date by text-to-speech (TTS).
|
|
.EXAMPLE
|
|
PS> ./say-date
|
|
(It's Sunday, October 17, 2021)
|
|
.NOTES
|
|
Author: Markus Fleschutz · License: CC0
|
|
.LINK
|
|
https://github.com/fleschutz/PowerShell
|
|
#>
|
|
|
|
try {
|
|
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
|
$Weekday = (Get-Date -format "dddd")
|
|
$CurrentDate = (Get-Date).ToShortDateString()
|
|
$Answer = "It's $Weekday, $CurrentDate"
|
|
& "$PSScriptRoot/speak-english.ps1" "$Answer"
|
|
write-output "$Answer"
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
|
exit 1
|
|
}
|