2024-10-01 15:24:16 +02:00
|
|
|
|
<#
|
2021-10-27 13:13:36 +02:00
|
|
|
|
.SYNOPSIS
|
2021-12-11 12:32:03 +01:00
|
|
|
|
Spells a word
|
2021-10-27 13:13:36 +02:00
|
|
|
|
.DESCRIPTION
|
2022-01-30 10:49:30 +01:00
|
|
|
|
This PowerShell script spells the given word by text-to-speech (TTS).
|
2021-12-11 15:49:59 +01:00
|
|
|
|
.PARAMETER word
|
2024-11-20 15:32:45 +01:00
|
|
|
|
Specifies the word to spell (queried by default)
|
2021-10-27 13:13:36 +02:00
|
|
|
|
.EXAMPLE
|
2024-11-20 15:32:45 +01:00
|
|
|
|
PS> ./spell-word.ps1 Yoda
|
|
|
|
|
(listen)
|
2021-10-27 13:13:36 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2022-01-30 10:49:30 +01:00
|
|
|
|
.NOTES
|
2022-09-06 21:42:04 +02:00
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-10-27 13:13:36 +02:00
|
|
|
|
#>
|
|
|
|
|
|
2021-12-11 15:49:59 +01:00
|
|
|
|
param([string]$word = "")
|
2021-12-11 12:32:03 +01:00
|
|
|
|
|
2021-12-11 15:49:59 +01:00
|
|
|
|
try {
|
2024-11-20 15:32:45 +01:00
|
|
|
|
if ($word -eq "" ) { $word = Read-Host "Enter the word to spell" }
|
2021-12-11 15:49:59 +01:00
|
|
|
|
|
2024-11-20 15:32:45 +01:00
|
|
|
|
[char[]]$array = $word.ToUpper()
|
|
|
|
|
$reply = ""
|
|
|
|
|
foreach($char in $array) {
|
|
|
|
|
$reply += $char + ", "
|
2021-12-11 15:49:59 +01:00
|
|
|
|
}
|
2024-11-20 15:32:45 +01:00
|
|
|
|
& "$PSScriptRoot/speak-english.ps1" $reply
|
2021-12-11 15:49:59 +01:00
|
|
|
|
exit 0 # success
|
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-12-11 15:49:59 +01:00
|
|
|
|
exit 1
|
2022-01-30 10:49:30 +01:00
|
|
|
|
}
|