mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-22 01:48:20 +02:00
Update speak-joke.ps1
This commit is contained in:
parent
8eeb088252
commit
4bcce0a10e
@ -1,10 +1,11 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Speaks a random Chuck Norris joke by text-to-speech (TTS)
|
Speaks a random Chuck Norris joke by text-to-speech
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
speak-joke.ps1
|
This script selects a random joke in Data/jokes.csv and uses text-to-speech (TTS) for output.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./speak-joke
|
PS> ./speak-joke
|
||||||
|
(listen and have fun)
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz · License: CC0
|
Author: Markus Fleschutz · License: CC0
|
||||||
.LINK
|
.LINK
|
||||||
@ -13,10 +14,9 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
|
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
|
||||||
$NumRows = $Table.count
|
|
||||||
|
|
||||||
$Generator = New-Object System.Random
|
$Generator = New-Object System.Random
|
||||||
$Index = [int]$Generator.next(0,$NumRows - 1)
|
$Index = [int]$Generator.next(0, $Table.Count - 1)
|
||||||
$Joke = $Table[$Index].Joke
|
$Joke = $Table[$Index].Joke
|
||||||
|
|
||||||
& "$PSScriptRoot/speak-english.ps1" "$Joke"
|
& "$PSScriptRoot/speak-english.ps1" "$Joke"
|
||||||
|
Loading…
Reference in New Issue
Block a user