Piyush Posted January 13, 2011 Posted January 13, 2011 Here is my script.... expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;Create voice and ear for jarvis here---- OnAutoItExitRegister("bye") Global $RecoContext = ObjCreate("SAPI.SpSharedRecoContext") If @error Then MsgBox(0, "", "Error opening the 'SAPI.SpSharedRecoContext' object. Error number: " & Hex(@error, 8)) Exit EndIf $voice = ObjCreate("SAPI.Spvoice") $GRAMMER = $RecoContext.CreateGrammar $GRAMMER.cmdloadfromfile("test.xml") $GRAMMER.cmdsetruleidstate(0, 1) $event = ObjEvent($RecoContext, "event_") $RecoContext.eventinterests = 16 + 512 + 1024 ;~ Global $h_Category = ObjCreate("SAPI.SpObjectTokenCategory") ;~ $h_Category.SetId("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn\") ;~ Global $h_Token = ObjCreate("SAPI.SpObjectToken") ;~ $h_Token.SetId("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn\") ;~ $RecoContext.recognizer.AudioInput = $h_Token Func event_Recognition($1, $2, $3, $4) $text = $4.phraseinfo.gettext() If $text = "exit" Then $RecoContext.voice.speak("Closing Sir") Exit EndIf If $text = "David" Or $text = "COMPUTER" Or $text = "hey" Or $text = "chote" Or $text = "darling" Then $RecoContext.voice.rate = 3 ;~ $RecoContext.voice.voice=$RecoContext.voice.getvoices.item(2) $RecoContext.voice.speak("Yes Sir") Else $RecoContext.voice.speak($text) EndIf EndFunc ;==>event_Recognition Func event_FalseRecognition($1, $2, $3) ConsoleWrite($3.phraseinfo.gettext() & @CRLF) EndFunc ;==>event_FalseRecognition While 1 Sleep(5000) ;Allow the Audio In to finalize processing on the last 5 second capture $RecoContext.Pause ;Resume audio in processing $RecoContext.Resume $event = ObjEvent($RecoContext, "event_") WEnd Func bye() $RecoContext=0 $GRAMMER=0 EndFunc ;==>bye when..i compile this script and run the EXE file it show this Error... Line 13 (File "C:\Documents and Settings\Administrator\Desktop\super software\speech.exe"): Error: The requested action with this object has failed. but it runs fine and gives no error when..i run..it through scite..i don't know why it is giving me error after compilation... Can't think of anything...please help... [font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font]
Piyush Posted January 13, 2011 Author Posted January 13, 2011 problem solved guys..woooohooo!! [font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font]
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