Sign in to follow this  
Followers 0
Frenchy

Problem with speech recognition

2 posts in this topic

#1 ·  Posted (edited)

hello need help to understand error with the object com SAPI

here the code:

CODE
$RecoContext = ObjCreate("SAPI.SpSharedRecoContext")

$SinkObject = ObjEvent($RecoContext, "MYEvent_")

;GUICtrlSetData($GUIEdit, "ObjEvent created Successfully!" & @CRLF, "append")

;Imported from: SAPI.H

Const $SPRS_INACTIVE = 0

Const $SPRS_ACTIVE = 1

$SGDSActive = $SPRS_ACTIVE

$SGDSInactive = $SPRS_INACTIVE

$Grammar = $RecoContext.CreateGrammar(0)

$Grammar.Dictationload

$Grammar.DictationSetState($SGDSActive)

$prules=$Grammar.Rules

$prulec = $prules.Add( "wordsRule", 0x01 + 0x20,0)

;$prulec.Clear

$pstate = $prulec.InitialState

$pstate.AddWordTransition ("","One");

so i dont understand the error i have on the last line

C:\autoitrecon.au3 (42) : ==> The requested action with this object has failed.:

$pstate.AddWordTransition ("","One")

$pstate.AddWordTransition ("","One")^ ERROR

i have read the SDK and some samples already written in other langage ..but dont understand

maybe an autoit problem?

Edited by Frenchy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hum i have trapped th eror code and its mismatch...???

so the method AddWordTransition could have Null pointer as first argument..? is it the error???

definition in help sdk is

ISpeechGrammarRuleState.AddWordTransition(
     DestinationState As ISpeechGrammarRuleState,
     Words As String,
     [Separators As String = " "],
     [Type As SpeechGrammarWordType = SGLexical],
     [PropertyName As String = ""],
     [PropertyId As Long = 0],
     [PropertyValue As Variant = 0],
     [Weight As Single = 1.0]
)
Edited by Frenchy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0