Search the Community
Showing results for tags 'sapi 5'.
-
Hello all" I have curious problem with com object implementation of Sapi 5.1. In some cases }Some Voice engines] the metods for retrieve the voice parameters fails with error :Member not exists:. But the Retrieved Voice object can speak the given text, so It exists and work. Example of this type of Engine can be this one: http://download.kobavision.be/KobaSpeech3/KobaSpeech 3 With Vocalizer Serena - English (Great Britain).exe (can work as demo) So my question is> Is there some way to workaround or solve this issue? What i tryed: 1. Typical use of Sapi.spvoice object: $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler $spvoice = ObjCreate("sapi.spvoice") for $voice in $spvoice.getvoices() msgbox(0, "Voice", $voice.getdescription()) next Func MyErrFunc() $HexNumber = hex($oMyError.number, 8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF &"Number is: " & $HexNumber & @CRLF &"Windescription is: " & $oMyError.windescription) SetError(1) Endfunc 2. Implement workaround based on Nvda Screen reader sapi5 Library at https://github.com/nvaccess/nvda/blob/master/source/synthDrivers/sapi5.py Thys code in Pascal should work, so i tryed to reproduce it in Autoit. Pascal code just as example: SOTokens:=SpVoice.GetVoices('',''); for i:=0 to SOTokens.Count-1 do try SOToken:=SOTokens.Item(I); s:=SOToken.GetDescription(0); end In Autoit I tryed it like this: $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler $spvoice = ObjCreate("sapi.spvoice") for $i = 0 to $spvoice.getvoices.count-1 $name = $spvoice.getvoices.item($i).getdescription msgbox(0,"Voice", $name) next Func MyErrFunc() $HexNumber = hex($oMyError.number, 8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF &"Number is: " & $HexNumber & @CRLF &"Windescription is: " & $oMyError.windescription) SetError(1) Endfunc Both of this methods returning same Error ("Member not exists."). Thanks a lot for help. Znefyg