mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-21 15:33:15 +01:00
Updated spell-word.ps1
This commit is contained in:
parent
8136a01507
commit
17f1c85af2
@ -4,9 +4,10 @@
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script spells the given word by text-to-speech (TTS).
|
This PowerShell script spells the given word by text-to-speech (TTS).
|
||||||
.PARAMETER word
|
.PARAMETER word
|
||||||
Specifies the word to spell
|
Specifies the word to spell (queried by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./spell-word
|
PS> ./spell-word.ps1 Yoda
|
||||||
|
(listen)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -16,15 +17,14 @@
|
|||||||
param([string]$word = "")
|
param([string]$word = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($word -eq "" ) { $word = read-host "Enter word to spell" }
|
if ($word -eq "" ) { $word = Read-Host "Enter the word to spell" }
|
||||||
|
|
||||||
[char[]]$ArrayOfChars = $word.ToUpper()
|
[char[]]$array = $word.ToUpper()
|
||||||
$Reply = ""
|
$reply = ""
|
||||||
foreach($Char in $ArrayOfChars) {
|
foreach($char in $array) {
|
||||||
$Reply += $Char
|
$reply += $char + ", "
|
||||||
$Reply += " "
|
|
||||||
}
|
}
|
||||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
& "$PSScriptRoot/speak-english.ps1" $reply
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user