Shanheavel Posted May 19, 2011 Posted May 19, 2011 Hello,I'm using code from post.expandcollapse popup$oRecoContext = ObjCreate('SAPI.SpSharedRecoContext') If @error Then MsgBox(0, '', 'Object Creation Failed') Exit EndIf ConsoleWrite('You can speak now' & @CRLF) ObjEvent($oRecoContext, 'RecoContext_') Global $oVBS = ObjCreate("ScriptControl") $oVBS.Language = "VBScript" Global Const $oNothing = $oVBS.Eval("Nothing") $oGrammar = $oRecoContext.CreateGrammar() $oTopRule = $oGrammar.Rules.Add('RUN', 1, 0) $oWordsRule = $oGrammar.Rules.Add('WORDS', BitOR(1, 32), 1) $oAfterCmdState = $oTopRule.AddState() $oTopRule.InitialState.AddWordTransition($oAfterCmdState, 'run') $oAfterCmdState.AddRuleTransition($oNothing, $oWordsRule) $oWordsRule.InitialState.AddWordTransition($oNothing, 'notepad') ;~ $oWordsRule.InitialState.AddWordTransition($oNothing, 'whatever') $oGrammar.Rules.Commit() $oGrammar.CmdSetRuleState('RUN', 1) While 1 Sleep(10) WEnd Func RecoContext_FalseRecognition($iStreamNumber, $vStreamPosition, $iResult) ConsoleWrite("(no recognition)" & @CRLF) EndFunc ;==>RecoContext_FalseRecognition Func RecoContext_Recognition($iStreamNumber, $vStreamPosition, $iRecognitionType, $iResult) ConsoleWrite($iResult.PhraseInfo.GetText() & @CRLF) If $iResult.PhraseInfo.Elements.Item(1).DisplayText = 'notepad' Then Run('notepad.exe') EndIf EndFunc ;==>RecoContext_RecognitionYou need: Microsoft Speech SDK 5.1How it works? When I speak 'run notepad' it recognizes voice and run notepad.exe. Everything works great... but only for some time. After ~ 2 minutes voice commands don't work!Where is problem? (main loop works fine)I'm waiting for your reply. Thanks for help! =)/Adrian
monoscout999 Posted May 19, 2011 Posted May 19, 2011 just curiosity i never use objects and SAPI before... how can i solve this? F:\Agustin\autoit\Foro Autoit\sapi.au3 (11) : ==> Variable must be of type "Object".: $oVBS.Language = "VBScript" $oVBS^ ERROR
trancexx Posted May 19, 2011 Posted May 19, 2011 just curiosity i never use objects and SAPI before... how can i solve this? F:\Agustin\autoit\Foro Autoit\sapi.au3 (11) : ==> Variable must be of type "Object".: $oVBS.Language = "VBScript" $oVBS^ ERROR x64? Run 32-bit AutoIt. ♡♡♡ . eMyvnE
trancexx Posted May 22, 2011 Posted May 22, 2011 So, you are vertical bumper. I saw that once before. ♡♡♡ . eMyvnE
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now