Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Param(
- [Parameter(Mandatory = $False)]
- [string]$text
- )
- if (!($text)) {
- $text = "no text was provided to the script"
- }
- Write-Output $text
- $spk = New-Object -ComObject SAPI.SpVoice
- $spk.Speak($text)
- Add-Type -AssemblyName System.Speech
- $speech = New-Object System.Speech.Synthesis.SpeechSynthesizer
- Foreach ($voice in $speech.GetInstalledVoices()) {
- $Voice.VoiceInfo | Select-Object Gender, Name, Culture, Description
- }
- $speech.SelectVoice("Microsoft Zira Desktop")
- $speech.Speak($text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement