From 17f1c85af2c8819d80ea448570f7478a84a60132 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 20 Nov 2024 15:32:45 +0100 Subject: [PATCH] Updated spell-word.ps1 --- scripts/spell-word.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/spell-word.ps1 b/scripts/spell-word.ps1 index 0d21778a..bacb2170 100755 --- a/scripts/spell-word.ps1 +++ b/scripts/spell-word.ps1 @@ -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])"