mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-24 02:48:17 +02:00
Added speak-date.ps1
This commit is contained in:
parent
891548f6b4
commit
3dc9fd05ba
@ -65,6 +65,7 @@ SHA1.ps1, prints the SHA1 checksum of the given file
|
|||||||
SHA256.ps1, prints the SHA256 checksum of the given file
|
SHA256.ps1, prints the SHA256 checksum of the given file
|
||||||
simulate-matrix.ps1, simulates the Matrix (fun)
|
simulate-matrix.ps1, simulates the Matrix (fun)
|
||||||
simulate-presence.ps1, simulates the human presence against burglars
|
simulate-presence.ps1, simulates the human presence against burglars
|
||||||
|
speak-date.ps1, speaks the current date by text-to-speech (TTS)
|
||||||
speak-file.ps1, speaks the content of the given text file by text-to-speech (TTS)
|
speak-file.ps1, speaks the content of the given text file by text-to-speech (TTS)
|
||||||
speak-test.ps1, performs a speak test by text-to-speech (TTS)
|
speak-test.ps1, performs a speak test by text-to-speech (TTS)
|
||||||
speak-text.ps1, speaks the given text by text-to-speech (TTS)
|
speak-text.ps1, speaks the given text by text-to-speech (TTS)
|
||||||
|
|
@ -73,6 +73,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
|
|||||||
* [SHA256.ps1](Scripts/SHA256.ps1) - prints the SHA256 checksum of the given file
|
* [SHA256.ps1](Scripts/SHA256.ps1) - prints the SHA256 checksum of the given file
|
||||||
* [simulate-matrix.ps1](Scripts/simulate-matrix.ps1) - simulates the Matrix (fun)
|
* [simulate-matrix.ps1](Scripts/simulate-matrix.ps1) - simulates the Matrix (fun)
|
||||||
* [simulate-presence.ps1](Scripts/simulate-presence.ps1) - simulates the human presence against burglars
|
* [simulate-presence.ps1](Scripts/simulate-presence.ps1) - simulates the human presence against burglars
|
||||||
|
* [speak-date.ps1](Scripts/speak-date.ps1) - speaks the current date by text-to-speech (TTS)
|
||||||
* [speak-file.ps1](Scripts/speak-file.ps1) - speaks the content of the given text file by text-to-speech (TTS)
|
* [speak-file.ps1](Scripts/speak-file.ps1) - speaks the content of the given text file by text-to-speech (TTS)
|
||||||
* [speak-test.ps1](Scripts/speak-test.ps1) - performs a speak test by text-to-speech (TTS)
|
* [speak-test.ps1](Scripts/speak-test.ps1) - performs a speak test by text-to-speech (TTS)
|
||||||
* [speak-text.ps1](Scripts/speak-text.ps1) - speaks the given text by text-to-speech (TTS)
|
* [speak-text.ps1](Scripts/speak-text.ps1) - speaks the given text by text-to-speech (TTS)
|
||||||
|
22
Scripts/speak-date.ps1
Normal file
22
Scripts/speak-date.ps1
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/snap/bin/powershell
|
||||||
|
<#
|
||||||
|
.SYNTAX ./speak-date.ps1
|
||||||
|
.DESCRIPTION speaks the current date by text-to-speech (TTS)
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Speak([string]$Text) {
|
||||||
|
write-progress "$Text"
|
||||||
|
$Voice = new-object -ComObject SAPI.SPVoice
|
||||||
|
[void]$Voice.Speak($Text)
|
||||||
|
write-progress -complete "$Text"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Speak("Today is $((Get-Date).ToShortDateString())")
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
@ -6,10 +6,15 @@
|
|||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
function Speak([string]$Text) {
|
||||||
|
write-progress "$Text"
|
||||||
$Voice = new-object -ComObject SAPI.SPVoice
|
$Voice = new-object -ComObject SAPI.SPVoice
|
||||||
$Text = "The current time is $((Get-Date).ToShortTimeString())"
|
[void]$Voice.Speak($Text)
|
||||||
$Result = $Voice.Speak($Text)
|
write-progress -complete "$Text"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Speak("It's now $((Get-Date).ToShortTimeString())")
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user