File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Speaks text in Croatian
4
+ . DESCRIPTION
5
+ This PowerShell script speaks the given text with a Croatian text-to-speech (TTS) voice.
6
+ . PARAMETER text
7
+ Specifies the Croatian text to speak
8
+ . EXAMPLE
9
+ PS> ./speak-croatian.ps1 zdravo
10
+ . LINK
11
+ https://github.com/fleschutz/PowerShell
12
+ . NOTES
13
+ Author: Markus Fleschutz | License: CC0
14
+ #>
15
+
16
+ param ([string ]$text = " " )
17
+
18
+ try {
19
+ if ($text -eq " " ) { $text = Read-Host " Enter the Croatian text to speak" }
20
+
21
+ $TTS = New-Object - ComObject SAPI.SPVoice
22
+ foreach ($voice in $TTS.GetVoices ()) {
23
+ if ($voice.GetDescription () -like " *- Croatian*" ) {
24
+ $TTS.Voice = $voice
25
+ [void ]$TTS.Speak ($text )
26
+ exit 0 # success
27
+ }
28
+ }
29
+ throw " No Croatian text-to-speech voice found - please install one."
30
+ } catch {
31
+ " ⚠️ Error in line $ ( $_.InvocationInfo.ScriptLineNumber ) : $ ( $Error [0 ]) "
32
+ exit 1
33
+ }
You can’t perform that action at this time.
0 commit comments