Added speak-time.ps1

This commit is contained in:
Markus Fleschutz 2021-01-02 13:46:38 +01:00
parent 31848acec0
commit 9f7552b386
3 changed files with 20 additions and 1 deletions

View File

@ -60,6 +60,7 @@ simulate-presence.ps1, simulates the human presence against burglars
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)
speak-time.ps1, speaks the current time by text-to-speech (TTS)
switch-shelly1.ps1, switches a Shelly1 device in the local network switch-shelly1.ps1, switches a Shelly1 device in the local network
take-screenshot.ps1, takes a single screenshot take-screenshot.ps1, takes a single screenshot
take-screenshots.ps1, takes multiple screenshots take-screenshots.ps1, takes multiple screenshots

1 Filename Description
60 speak-file.ps1 speaks the content of the given text file by text-to-speech (TTS)
61 speak-test.ps1 performs a speak test by text-to-speech (TTS)
62 speak-text.ps1 speaks the given text by text-to-speech (TTS)
63 speak-time.ps1 speaks the current time by text-to-speech (TTS)
64 switch-shelly1.ps1 switches a Shelly1 device in the local network
65 take-screenshot.ps1 takes a single screenshot
66 take-screenshots.ps1 takes multiple screenshots

View File

@ -1,7 +1,7 @@
Collection of Useful PowerShell Scripts Collection of Useful PowerShell Scripts
======================================= =======================================
This repository contains 80+ useful and cross-platform PowerShell scripts - to be used by command-line interface (CLI), for remote control (RC), by context menu, by voice control, by automation software (e.g. Jenkins), or simply to learn PowerShell. This repository contains 90+ useful and cross-platform PowerShell scripts - to be used by command-line interface (CLI), for remote control (RC), by context menu, by voice control, by automation software (e.g. Jenkins), or simply to learn PowerShell.
List of Scripts List of Scripts
--------------- ---------------
@ -68,6 +68,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [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)
* [speak-time.ps1](Scripts/speak-time.ps1) - speaks the current time by text-to-speech (TTS)
* [switch-shelly1.ps1](Scripts/switch-shelly1.ps1) - switches a Shelly1 device in the local network * [switch-shelly1.ps1](Scripts/switch-shelly1.ps1) - switches a Shelly1 device in the local network
* [take-screenshot.ps1](Scripts/take-screenshot.ps1) - takes a single screenshot * [take-screenshot.ps1](Scripts/take-screenshot.ps1) - takes a single screenshot
* [take-screenshots.ps1](Scripts/take-screenshots.ps1) - takes multiple screenshots * [take-screenshots.ps1](Scripts/take-screenshots.ps1) - takes multiple screenshots

17
Scripts/speak-time.ps1 Normal file
View File

@ -0,0 +1,17 @@
#!/snap/bin/powershell
<#
.SYNTAX ./speak-time.ps1
.DESCRIPTION speaks the current time by text-to-speech (TTS)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
try {
$Voice = new-object -ComObject SAPI.SPVoice
$Text = "The current time is $((Get-Date).ToShortTimeString())"
$Result = $Voice.Speak($Text)
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}