2021-09-27 10:38:12 +02:00
|
|
|
|
<#
|
2021-08-08 11:02:12 +02:00
|
|
|
|
.SYNOPSIS
|
2023-08-24 14:29:49 +02:00
|
|
|
|
Tells a random quote by text-to-speech
|
2021-10-04 21:29:23 +02:00
|
|
|
|
.DESCRIPTION
|
2023-08-09 17:18:53 +02:00
|
|
|
|
This PowerShell script selects a random quote from Data/quotes.csv and speaks it by text-to-speech (TTS).
|
2021-08-08 11:02:12 +02:00
|
|
|
|
.EXAMPLE
|
2023-08-09 17:18:53 +02:00
|
|
|
|
PS> ./tell-quote.ps1
|
|
|
|
|
(listen and enjoy)
|
2021-08-08 11:02:12 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2022-01-30 10:49:30 +01:00
|
|
|
|
.NOTES
|
2022-09-06 21:42:04 +02:00
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-08-08 11:02:12 +02:00
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
try {
|
2023-08-09 17:18:53 +02:00
|
|
|
|
$table = Import-CSV "$PSScriptRoot/../Data/quotes.csv"
|
2021-08-08 11:02:12 +02:00
|
|
|
|
|
2023-08-09 17:18:53 +02:00
|
|
|
|
$randomNumberGenerator = New-Object System.Random
|
|
|
|
|
$row = [int]$randomNumberGenerator.next(0, $table.Count - 1)
|
2021-08-08 11:02:12 +02:00
|
|
|
|
|
2023-08-10 11:35:46 +02:00
|
|
|
|
& "$PSScriptRoot/speak-english.ps1" "$($table[$row].QUOTE). By $($table[$row].AUTHOR)."
|
2021-09-27 10:09:45 +02:00
|
|
|
|
exit 0 # success
|
2021-08-08 11:02:12 +02:00
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-08-08 11:02:12 +02:00
|
|
|
|
exit 1
|
|
|
|
|
}
|