Initial commit
This commit is contained in:
21
Powershell/Speech/say-old.ps1
Normal file
21
Powershell/Speech/say-old.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
# Check if the System.Speech assembly is available
|
||||
try {
|
||||
Add-Type -AssemblyName System.Speech
|
||||
} catch {
|
||||
Write-Error "Windows Text-to-Speech (SAPI5) is not installed or not available. Please ensure you have Windows 10/11 with the latest updates."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Get user input
|
||||
$text = Read-Host "Enter text to speak:"
|
||||
|
||||
# Create a SpeechSynthesizer instance
|
||||
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
||||
|
||||
try {
|
||||
# Speak the text
|
||||
$synth.Speak($text)
|
||||
Write-Host "Text spoken successfully."
|
||||
} catch {
|
||||
Write-Error "Error speaking text: $_"
|
||||
}
|
||||
Reference in New Issue
Block a user