From 9f7552b38665e2f68b14bc347ac02094374c8e33 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sat, 2 Jan 2021 13:46:38 +0100 Subject: [PATCH] Added speak-time.ps1 --- Data/scripts.csv | 1 + README.md | 3 ++- Scripts/speak-time.ps1 | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 Scripts/speak-time.ps1 diff --git a/Data/scripts.csv b/Data/scripts.csv index 1bbe6c7a..634aaf3a 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -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-test.ps1, performs a speak test 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 take-screenshot.ps1, takes a single screenshot take-screenshots.ps1, takes multiple screenshots diff --git a/README.md b/README.md index 79d52b2a..a315961c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ 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 --------------- @@ -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-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-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 * [take-screenshot.ps1](Scripts/take-screenshot.ps1) - takes a single screenshot * [take-screenshots.ps1](Scripts/take-screenshots.ps1) - takes multiple screenshots diff --git a/Scripts/speak-time.ps1 b/Scripts/speak-time.ps1 new file mode 100644 index 00000000..fb330220 --- /dev/null +++ b/Scripts/speak-time.ps1 @@ -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 +}