-
-
Notifications
You must be signed in to change notification settings - Fork 545
Expand file tree
/
Copy pathspell-word.ps1
More file actions
executable file
·32 lines (29 loc) · 709 Bytes
/
spell-word.ps1
File metadata and controls
executable file
·32 lines (29 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<#
.SYNOPSIS
Spells a word
.DESCRIPTION
This PowerShell script spells the given word by text-to-speech (TTS).
.PARAMETER word
Specifies the word to spell (queried by default)
.EXAMPLE
PS> ./spell-word.ps1 Yoda
(listen)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$word = "")
try {
if ($word -eq "" ) { $word = Read-Host "Enter the word to spell" }
[char[]]$array = $word.ToUpper()
$reply = ""
foreach($char in $array) {
$reply += $char + ", "
}
& "$PSScriptRoot/speak-english.ps1" $reply
exit 0 # success
} catch {
"⚠️ ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}