Recently, I found out about the spvoice interface. Therefore, I wanted to make a small program that makes Powershell say something I type into it. So, I made this:
$Voice = New-Object -ComObject Sapi.spvoice
for(;;){
Clear-Host
$UserInput = Read-Host
if($UserInput -eq "Voice.Rate"){
$VoiceRate = Read-Host "Set new voice rate"}
else{
$Voice.rate = $VoiceRate
$Voice.speak("$UserInput")}}
And although it did whatever I wanted it to, the .speak() method was returning the number 1. How can I prevent this from happening?