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
|
||||
This PowerShell script spells the given word by text-to-speech (TTS).
|
||||
.PARAMETER word
|
||||
Specifies the word to spell
|
||||
Specifies the word to spell (queried by default)
|
||||
.EXAMPLE
|
||||
PS> ./spell-word
|
||||
PS> ./spell-word.ps1 Yoda
|
||||
(listen)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -16,15 +17,14 @@
|
||||
param([string]$word = "")
|
||||
|
||||
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()
|
||||
$Reply = ""
|
||||
foreach($Char in $ArrayOfChars) {
|
||||
$Reply += $Char
|
||||
$Reply += " "
|
||||
[char[]]$array = $word.ToUpper()
|
||||
$reply = ""
|
||||
foreach($char in $array) {
|
||||
$reply += $char + ", "
|
||||
}
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" $reply
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user