MS SAPI Voice training for clash of clans Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Guest

MS SAPI Voice training for clash of clans  Topic is solved

Post by Guest » 30 Oct 2014, 21:26

Hi all,
I got the Keep Alive and Gold/Elixir search in my script working (playing the game on BlueStacks). And I also have voice commands for my troops working ("Send 10 giants from the north east" etc) ... well sort of.. sometimes ms SAPI cant pick up my words... so what I want to do is train sapi using the built in voice training dialog... I'm just not sure how to bring up the dialog thru the COM interface... This is what i got:

pspeaker := ComObjCreate("SAPI.SpVoice")
pspeaker.volume := 100
plistener := ComObjCreate("SAPI.SpInprocRecognizer") ; For not showing Windows Voice Recognition widget.
paudioinputs := plistener.GetAudioInputs() ; For not showing Windows Voice Recognition widget.
plistener.AudioInput := paudioinputs.Item(0) ; For not showing Windows Voice Recognition widget.
ObjRelease(paudioinputs) ; Release object from memory, it is not needed anymore.
pcontext := plistener.CreateRecoContext()
pgrammar := pcontext.CreateGrammar()
pgrammar.DictationSetState(0)
prules := pgrammar.Rules()
prulec := prules.Add("wordsRule", 0x1|0x20)
prulec.Clear()
pstate := prulec.InitialState()


; add more like this here
pstate.AddWordTransition(ComObjParameter(13, 0), "giants")
pstate.AddWordTransition(ComObjParameter(13, 0), "send")
..
..

F1:
;********** bring up voice recognition dialog *** not working
WinGet, active_id, ID, A
pspeaker.displayui(active_id, "Training", "SPDUI_UserTraining")


Note: I do not want the user to go thru control panel and do voice training there... i want to be able press a button and have the voice trainning dialog popup with the COC commands ("Giants,Archers,Attack,Rage Spell,South West" etc)..


Thanks for the help

Return to “Gaming Help (v1)”