Skip to content

Commit af119fc

Browse files
committed
Rename to write-quote.ps1 and speak-quote.ps1
1 parent b1b52dc commit af119fc

9 files changed

Lines changed: 66 additions & 112 deletions

File tree

Data/quotes.csv

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Genre,Author,Quote
2+
IQ,Thomas Edison,"Genius is one percent inspiration and ninety-nine percent perspiration."
3+
Misc,Johann Wolfgang von Goethe,"Difficulties increase the nearer we get to the goal."
4+
Misc,William Shakespeare,"Having nothing, nothing can he lose."
5+
Misc,Albert Einstein,"Learn from yesterday, live for today, hope for tomorrow."
6+
Misc,Michelangelo,"Faith in oneself is the best and safest course."
7+
Misc,Sophocles,"It takes both sunshine and rain to make a rainbow."
8+
Misc,Mahatma Gandhi,"We must become the change we want to see."
9+
Misc,Johann Wolfgang von Goethe,"Knowing is not enough; we must apply!"
10+
Misc,Immanuel Kant,"Science is organized knowledge. Wisdom is organized life."
11+
Misc,Indira Gandhi,"You can't shake hands with a clenched fist."
12+
Misc,Albert Einstein,"Try not to become a man of success, but rather try to become a man of value."
13+
Misc,Pierre Auguste Renoir,"The pain passes, but the beauty remains."
14+
Misc,Heraclitus,"All is flux; nothing stays still."
15+
Misc,Japanese proverb,"The day you decide to do it is your lucky day."
16+
Misc,Abraham Lincoln,"The best thing about the future is that it only comes one day at a time."
17+
Misc,Epictetus,"We have two ears and one mouth so that we can listen twice as much as we speak."
18+
Misc,Cervantes,"Be slow of tongue and quick of eye."
19+
Misc,Bruce Lee,"Mistakes are always forgivable, if one has the courage to admit them."

Data/sayings.csv

Lines changed: 0 additions & 69 deletions
This file was deleted.

Data/scripts.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ speak-french.ps1, speaks the given text with a French text-to-speech (TTS) voice
186186
speak-german.ps1, speaks the given text with a German text-to-speech (TTS) voice
187187
speak-italian.ps1, speaks the given text with an Italian text-to-speech (TTS) voice
188188
speak-joke.ps1, speaks a random Chuck Norris joke by text-to-speech (TTS)
189-
speak-saying.ps1, speaks a random saying by text-to-speech (TTS)
189+
speak-quote.ps1, speaks a random quote by text-to-speech (TTS)
190190
speak-test.ps1, performs a speak test by text-to-speech (TTS)
191191
speak-text.ps1, speaks the given text by text-to-speech (TTS)
192192
speak-time.ps1, speaks the current time by text-to-speech (TTS)
@@ -219,9 +219,9 @@ write-lowercase.ps1, writes the given text in lowercase letters
219219
write-marquee.ps1, writes the given text as marquee
220220
write-morse-code.ps1, writes the given text in Morse code
221221
write-motd.ps1, writes the message of the day (MOTD)
222+
write-quote.ps1, writes a random quote
222223
write-red.ps1, writes the given text in a red foreground color
223224
write-rot13.ps1, encodes or decodes the given text with ROT13
224-
write-saying.ps1], writes a random saying
225225
write-typewriter.ps1, writes the given text with the typewriter effect
226226
write-uppercase.ps1, writes the given text in uppercase letters
227227
write-vertical.ps1, writes the given text in vertical direction

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Mega Collection of PowerShell Scripts
2727
* [speak-german.ps1](Scripts/speak-german.ps1) - speaks the given text with a German text-to-speech (TTS) voice
2828
* [speak-italian.ps1](Scripts/speak-italian.ps1) - speaks the given text with an Italian text-to-speech (TTS) voice
2929
* [speak-joke.ps1](Scripts/speak-joke.ps1) - speaks a random Chuck Norris joke by text-to-speech (TTS)
30-
* [speak-saying.ps1](Scripts/speak-saying.ps1) - speaks a random saying by text-to-speech (TTS)
30+
* [speak-quote.ps1](Scripts/speak-quote.ps1) - speaks a random quote by text-to-speech (TTS)
3131
* [speak-test.ps1](Scripts/speak-test.ps1) - performs a speak test by text-to-speech (TTS)
3232
* [speak-text.ps1](Scripts/speak-text.ps1) - speaks the given text by text-to-speech (TTS)
3333
* [speak-time.ps1](Scripts/speak-time.ps1) - speaks the current time by text-to-speech (TTS)
@@ -246,9 +246,9 @@ Mega Collection of PowerShell Scripts
246246
* [write-marquee.ps1](Scripts/write-marquee.ps1) - writes the given text as marquee
247247
* [write-morse-code.ps1](Scripts/write-morse-code.ps1) - writes the given text in Morse code
248248
* [write-motd.ps1](Scripts/write-motd.ps1) - writes the message of the day (MOTD)
249+
* [write-quote.ps1](Scripts/write-quote.ps1) - writes a random quote
249250
* [write-red.ps1](Scripts/write-red.ps1) - writes the given text in a red foreground color
250251
* [write-rot13.ps1](Scripts/write-rot13.ps1) - encodes or decodes the given text with ROT13
251-
* [write-saying.ps1](Scripts/write-saying.ps1) - writes a random saying
252252
* [write-typewriter.ps1](Scripts/write-typewriter.ps1) - writes the given text with the typewriter effect
253253
* [write-uppercase.ps1](Scripts/write-uppercase.ps1) - writes the given text in uppercase letters
254254
* [write-vertical.ps1](Scripts/write-vertical.ps1) - writes the given text in vertical direction

Scripts/speak-joke.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
try {
1616
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
17+
$NumRows = $Table.count
1718

1819
$Generator = New-Object System.Random
19-
$Index = [int]$Generator.next(0,66)
20-
20+
$Index = [int]$Generator.next(0,$NumRows - 1)
2121
$Joke = $Table[$Index].Joke
2222

2323
& "$PSScriptRoot/speak-english.ps1" "$Joke"

Scripts/speak-quote.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<#
2+
.SYNOPSIS
3+
speak-quote.ps1
4+
.DESCRIPTION
5+
Speaks a random quote by text-to-speech (TTS)
6+
.EXAMPLE
7+
PS> .\speak-quote.ps1
8+
.LINK
9+
https://github.com/fleschutz/PowerShell
10+
.NOTES
11+
Author: Markus Fleschutz
12+
License: CC0
13+
#>
14+
15+
try {
16+
$Table = import-csv "$PSScriptRoot/../Data/quotes.csv"
17+
$NumRows = $Table.count
18+
19+
$Generator = New-Object System.Random
20+
$Index = [int]$Generator.next(0,$NumRows - 1)
21+
$Quote = $Table[$Index].Quote
22+
$Author = $Table[$Index].Author
23+
24+
& "$PSScriptRoot/speak-english.ps1" "$Quote (by $Author)"
25+
exit 0
26+
} catch {
27+
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
28+
exit 1
29+
}

Scripts/speak-saying.ps1

Lines changed: 0 additions & 28 deletions
This file was deleted.

Scripts/write-joke.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414

1515
try {
1616
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
17+
$NumRows = $Table.count
1718

1819
$Generator = New-Object System.Random
19-
$Index = [int]$Generator.next(0,66)
20-
20+
$Index = [int]$Generator.next(0,$NumRows - 1)
2121
$Joke = $Table[$Index].Joke
22+
2223
"📣 $Joke"
2324
exit 0
2425
} catch {
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<#
22
.SYNOPSIS
3-
write-saying.ps1
3+
write-quote.ps1
44
.DESCRIPTION
5-
Writes a random saying to the console.
5+
Writes a random quote to the console.
66
.EXAMPLE
7-
PS> .\write-saying.ps1
7+
PS> .\write-quote.ps1
88
.LINK
99
https://github.com/fleschutz/PowerShell
1010
.NOTES
@@ -13,13 +13,15 @@
1313
#>
1414

1515
try {
16-
$Table = import-csv "$PSScriptRoot/../Data/sayings.csv"
16+
$Table = import-csv "$PSScriptRoot/../Data/quotes.csv"
17+
$NumRows = $Table.count
1718

1819
$Generator = New-Object System.Random
19-
$Index = [int]$Generator.next(0,66)
20+
$Index = [int]$Generator.next(0,$NumRows - 1)
21+
$Quote = $Table[$Index].Quote
22+
$Author = $Table[$Index].Author
2023

21-
$Line = $Table[$Index].Saying
22-
"📣 $Line"
24+
"📣 $Quote <$Author>"
2325
exit 0
2426
} catch {
2527
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

0 commit comments

Comments
 (0)