Rename to tell-joke.ps1, tell-quote.ps1 and tell-operating-system.ps1

This commit is contained in:
Markus Fleschutz
2021-11-24 13:13:29 +01:00
parent 56035668a0
commit 9d310d2521
4 changed files with 14 additions and 14 deletions

26
Scripts/tell-joke.ps1 Executable file
View File

@ -0,0 +1,26 @@
<#
.SYNOPSIS
Tells a joke by text-to-speech
.DESCRIPTION
This script selects a random Chuck Norris joke in Data/jokes.csv and speaks it by text-to-speech (TTS).
.EXAMPLE
PS> ./tell-joke
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0, $Table.Count - 1)
$Joke = $Table[$Index].Joke
& "$PSScriptRoot/speak-english.ps1" "$Joke"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}