Jump to content

Problem with speech recognition


Frenchy
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...