Functions/GenXdev.Console/SayDate.ps1
|
############################################################################### <# .SYNOPSIS Speaks the current date using text-to-speech synthesis. .DESCRIPTION Converts the current date into a natural language format and announces it using the system's text-to-speech engine. The date is spoken in the format: "It is [day of week], [month] [day] [year]" .LICENSE Copyright (C) 2026 René Vaessen / GenXdev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. .EXAMPLE SayDate Announces today's date using text-to-speech #> function SayDate { [CmdletBinding()] param() begin { # format current date into natural speech pattern # e.g. "It is Monday, January 1 2024" $dateText = 'It is ' + [DateTime]::Now.ToString('dddd, MMMM d yyyy') # log the text that will be spoken Microsoft.PowerShell.Utility\Write-Verbose "Preparing to speak: $dateText" } process { # use text-to-speech engine to announce the date # suppress output by assigning to $null $null = GenXdev\Start-TextToSpeech $dateText } end { } } |