diff --git a/scripts/speak-countdown.ps1 b/scripts/speak-countdown.ps1 index a37de476..06fb67d6 100755 --- a/scripts/speak-countdown.ps1 +++ b/scripts/speak-countdown.ps1 @@ -3,24 +3,25 @@ Speaks a countdown by text-to-speech .DESCRIPTION This PowerShell script speaks a countdown by text-to-speech (TTS) starting from a given number. -.PARAMETER StartNumber +.PARAMETER startNumber Specifies the number to start from (10 by default) .EXAMPLE PS> ./speak-countdown.ps1 60 + (listen and enjoy) .LINK https://github.com/fleschutz/PowerShell .NOTES Author: Markus Fleschutz | License: CC0 #> -param([int]$StartNumber = 10) +param([int]$startNumber = 10) try { - for ([int]$i = $StartNumber; $i -gt 0; $i--) { + for ([int]$i = $startNumber; $i -gt 0; $i--) { & "$PSScriptRoot/speak-english.ps1" $i Start-Sleep -milliseconds 200 } - & "$PSScriptRoot/speak-english.ps1" "zero" + & "$PSScriptRoot/speak-english.ps1" "Zero and lift-off!" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/speak-english.ps1 b/scripts/speak-english.ps1 index fc8be0fd..59b8df87 100755 --- a/scripts/speak-english.ps1 +++ b/scripts/speak-english.ps1 @@ -22,11 +22,10 @@ try { foreach ($voice in $TTS.GetVoices()) { if ($voice.GetDescription() -like "*- English*") { $TTS.Voice = $voice - [void]$TTS.Speak($text) - exit 0 # success } } - throw "No English text-to-speech voice found - please install one." + [void]$TTS.Speak($text) + exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1