AutoHotkey Community

It is currently May 27th, 2012, 3:01 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next
Author Message
 Post subject:
PostPosted: November 20th, 2009, 2:43 pm 
Offline

Joined: October 17th, 2009, 8:54 pm
Posts: 43
I cant seem to get OnRecognition() to trigger..

but first.. thank you to all you guys that have contributed to voice rec and the com lib, and have managed to get this stuff working to begin with...

I've been wrestling with this for days.. and nothing seems to work..

I'm on WinXP using SDK SAPI 5.1 with AHK 1.0.48.5. and the latest COM.ahk (http://www.autohotkey.com/forum/topic22923.html)
The SAPI examples from the MS SDK all seem to work fine in their C++/VB format, and the mic is working fine (at least in the MS apps it is), but within AHK it is all fubar..

maybe a bad audioinput setting, no mic activation?
this line appears redundant..
Code:
COM_Invoke(plistener, "AudioInput", paudioin ? "+" . paudioin : "+0")

forcing the string "+0" is the only thing that the AudioInput property seems to accept without throwing up an error..
for example this will start up without an error and show the correct description..
Code:
plistener:=              COM_CreateObject("SAPI.SpSharedRecognizer")
paudioin:=              COM_Invoke(plistener,    "AudioInput")
                              MsgBox % COM_Invoke(paudioin, "GetDescription")
                              COM_Invoke(plistener,"AudioInput", "+0")

But try this
Code:
plistener:=              COM_CreateObject("SAPI.SpSharedRecognizer")
paudioin:=              COM_Invoke(plistener,    "AudioInput")
                              MsgBox % COM_Invoke(paudioin, "GetDescription")
                              COM_Invoke(plistener,"AudioInput", "+" . paudioin)

and you get
Quote:
Function name "AudioInput"
ERROR: member not found (0x80020003)

A little Googling and it looks like whatever we are doing here with COM_Invoke to write this AudioInput property could be getting mangled somehow by the COM.ahk library. bit lost on this one though. It's as if the script is trying to read the value, not write it..
actually how does COM_invoke() know to write to a property and not read it anyway? it looks like in other parts of the code invoke is using "+" . 0 to tell the script to write to properties.. but not so with this audio input code..in fact if it is writing a value, it's a null value.. ahh.. but then the MS SDK docs say..
Quote:
AudioInput Property ....
SpObjectToken
Set: An SpObjectToken object that sets the property. If this parameter is Nothing, the default audio input device will be used.
so .. okay the null value here in paudioin causes a "+" . 0 with no 3rd parameter, so a blank write? and the default mic is activated... Still.. I doubt that if paudioin is ever set that it will ever work... I think this bit of code, will always fail... at least it does for me..
Code:
 paudioin ? "+" . paudioin


ok, so I hard code it now with..

COM_Invoke(plistener,"AudioInput", "+0")

but still it's not triggering OnRecognition()
next...

I can get the Text to Speech to work fine from within AHK, but no voice recognition. The ms docs say ..
Quote:
To create an ISpRecoContext for a shared ISpRecognizer, an application need only call COM's CoCreateInstance on the component CLSID_SpSharedRecoContext. In this case, SAPI will set up the audio input stream, setting it to SAPI's default audio input stream.

SpSharedRecoContext???? Nobody is using this anywhere on this forum? Is this a new thing?
And the MS docs are saying it will set up the audioinput for me, if I use SpSharedRecoContext.

so I tried coding a version using spSharedRecoContext...
Code:
                         COM_Init()
pspeaker :=              COM_CreateObject("SAPI.SpVoice")
pcontext :=               COM_CreateObject("SAPI.SpSharedRecoContext")

pgrammar :=            COM_Invoke(pcontext ,        "CreateGrammar")
                                COM_Invoke(pgrammar,       "DictationSetState", 0)
prules :=       COM_Invoke(pgrammar,       "Rules")
prulec :=       COM_Invoke(prules,         "Add", "wordsRule", 0x1|0x20)
      COM_Invoke(prulec,         "Clear")
pstate :=       COM_Invoke(prulec,         "InitialState")



I would bet for most of you, this would work, no need for redundant mic and volume setting, paudio and plistener are all gone, and it just goes direct to an established recoContext with pcontext:=

well at least it doesnt trigger any errors for me, but it doesnt do anything else either.

thought maybe dictationSetState =1 would make a differnece.. but no..

maybe it was the sharedReco? so I tried...
Code:
pcontext :=    COM_CreateObject("SAPI.SpRecoContext")

Ahh, and now we get errors, that we probably should get with spSharedRecoContext too...
upon createGrammar we get an invalid dispatch object error..

so abort on that idea

I moved on to
Code:
plistener:=    COM_CreateObject("SAPI.SpInProcRecognizer")
                                COM_Invoke(plistener,"AudioInput", "+0")
pcontext :=    COM_Invoke(plistener, "CreateRecoContext")


again, no errors but also no activation of onRecognition()

So maybe you guys can see what is wrong in here?? coz I'm lost..
Code:
#include c:\program files\autohotkey\COM.ahk
#Persistent
OnExit, CleanUp

                COM_Init()
pspeaker :=     COM_CreateObject(          "SAPI.SpVoice")
plistener:=     COM_CreateObject(          "SAPI.SpInProcRecognizer")
                COM_Invoke(plistener,      "AudioInput", "+0")
pcontext :=     COM_Invoke(plistener,      "CreateRecoContext")

pgrammar :=     COM_Invoke(pcontext ,      "CreateGrammar")
                COM_Invoke(pgrammar,       "DictationSetState", 0 )
prules :=       COM_Invoke(pgrammar,       "Rules")
prulec :=       COM_Invoke(prules,         "Add", "wordsRule", 0x1|0x20)
                COM_Invoke(prulec,         "Clear")
pstate :=       COM_Invoke(prulec,         "InitialState")

; Add here the words to be recognized!
                COM_Invoke(pstate,         "AddWordTransition", "+" . 0, "One")
                COM_Invoke(pstate,         "AddWordTransition", "+" . 0, "Two")         
                COM_Invoke(pstate,         "AddWordTransition", "+" . 0, "hello")
                COM_Invoke(pstate,         "AddWordTransition", "+" . 0, "kill")

                COM_Invoke(prules,         "Commit")
                COM_Invoke(pgrammar,       "CmdSetRuleState", "wordsRule", 1)
                COM_Invoke(prules,         "Commit")
pevent :=       COM_ConnectObject(pcontext,"On")

If (pspeaker && pcontext && pgrammar && prules && prulec && pstate) {
    COM_Invoke(pspeaker, "Speak", "Starting Succeeded")
}Else{
   COM_Invoke(pspeaker, "Speak", "Starting Failed")
}
Return

OnRecognition(prms, this){
   msgBox do anything ??? 
   presult :=    COM_DispGetParam(prms, 3, 9)
   pphrase :=    COM_Invoke(presult, "PhraseInfo")
   sText   :=    COM_Invoke(pphrase, "GetText")
            COM_Release(pphrase)
;   Add custom operations from here!
   if IsLabel(sText){
      GoSub,%sText%
    }else{
       COM_Invoke(pspeaker, "Speak", "You Said" . sText)
   }
   msgBox %sText% anything ??? 
}

kill:
CleanUp:
COM_Invoke(pspeaker, "Speak", "Shutting down")       
COM_Release(pspeaker)
COM_Release(pevent)
COM_Release(pstate)
COM_Release(prulec)
COM_Release(prules)
COM_Release(pgrammar)
COM_Release(pcontext)
COM_Release(plistener)
COM_Term()
ExitApp

hello:
   msgBox do something for goodness sake!!!
return


If it would just talk to me, or pop a message box, or show me that it is triggering OnRecognition.... does this work for anyone on XP...

oh another thing, if I use
plistener:= COM_CreateObject("SAPI.SpSharedRecognizer")
then it sets my mic input volume to 0 every time I start it up... turns off the mic, and I have to turn it back on manually..

please take a look at that code there, someone, and tell me what I'm missing.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 3:41 pm 
Offline

Joined: October 17th, 2009, 8:54 pm
Posts: 43
It looks to me like this is where it is failing..

Code:
pevent :=       COM_ConnectObject(pcontext,"On")


I set up a number of routines like OnHypothesis() and OnAudioLevel()

tried to set the eventInterests mask.. I assume that 1=enable it..
Code:
COM_Invoke(pcontext,    "EventInterests=", 33790)


and no events of any type are getting called.

So maybe there is something up with that connectObject call. in latest COM or maybe there is another way to set the callback rountine...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 1:04 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
AudioInput property is there mainly in case when switching to InProc engine, which is obligatory there (to non-trivial audio input device). With Shared engine, btw, AudioInput can't be set to non-trivial audio input device, only can be set to NULL, at least in SAPI 5.1. The error message kindly told you about it, but you just refused to listen. And, if there was no error message while COM_ConnectObject, the connection was succeeded. Why the engine didn't fire any events for you is a problem on your (system) side. Period. No more reply from me.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 4:58 pm 
Offline

Joined: October 17th, 2009, 8:54 pm
Posts: 43
thanx sean..

well I'll be the first to admit, I'm not getting it..so just ignoring things, kind of goes with the territory. Im wondering if this then is an XP specific thing and all you guys on Vista are without problems??? Is it working for anyone on XP?

maybe someone else can suggest something, or maybe this will help someone else out who is struggling with their setup.

So I understand now, this code should work, if COM_connectObject has succeeded and therefore we should assume that the OnRecognition callback function should be magically hooked into the SAPI event chain.

when it doesnt work though, how do you even begin to test and debug what is actually happening system wise, or to the SAPI callback setup?

In the SAPI docs Step 4: of 'Using Events with TTS' it talks about calling setInterest(), but is not really needed to trigger RECOGNIZE for SR, but perhaps it is worth noting that even if you try to COM_Invoke(pcontext, "EventInterests", **with Anything**)
say to force AudioLevel active that it still wont expose the event, it just ignores anything you try to do with the EventInterests, and sticks to the defaults.
Quote:
Setting messages
Regardless of the interests set, the application has to associate a message to SAPI. This is done with ISpNotifySource::SetNotifyWindowMessage. If this call is not included, no message could be sent back to the application. There are three types of message notifications and at least one must be included to receive messages....

where and how is this happening? At first glance you imagine that it is probably within the connectObject call, but when you go fishing in COM_connectObject to find out how and where.. ouch!! your brain bleeds man. If this call is not happening though, then we have a possible reason for no events being sent back to the app, I assume that this kind of call happens automagically with COM?
In Step 5 of the SAPI docs..
Quote:
The second step is to determine which interest occurred. ...... However, in larger applications or if several interests were set, the application must be able to determine the exact one. SAPI determines this using the event structure, SPEVENT and the GetEvents method. Used together, you can retrieve specific information about the SAPI event, including the type of interest.

I take it that somewhere there is some kind of event manager that is calling the GetEvents method, then decoding the interest into the name OnRecognize() and then making a call into the Autohotkey interpreter and activating the OnRecognize() function..
does anyone see how this happens? Or how I can verify that this event is hooked in? Can we force an event into the system and see what is triggered?
I can see how we send "On" to the connectObject, and even how we can append "Recognition" into the 3rd argument, but the rest of the process is about as cryptic as it gets. but then where is the dispatch functionality? can someone suggest where the docs are that explain how to hook a callback function in.

At the end of the day, you cant tell if the mic input is never intecepted and decoded so an event is never triggered, or if the event handler just isnt there within autohotkey so the dispatch never happens.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 1:22 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
OK, this will be probably my last post on this thread as I'm now on non-English Windows 7 64-bit where SR is not supported.

1) Be sure you're on English Windows.
2) Check
Code:
MsgBox % NumGet(pevent+20)
It should be a non-zero integer, likely to be 1.
3) Change the dictation state in the script to 1.
Code:
COM_Invoke(pgrammar, "DictationSetState", 1)
4) Try to emulate by adding and pressing the hotkey.
Code:
^+A::COM_Invoke(plistener, "EmulateRecognition", "This is a test.", 0, 0x0409)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 12:44 pm 
Offline

Joined: October 17th, 2009, 8:54 pm
Posts: 43
ahh ok.. getting warmer..

MsgBox % NumGet(pevent+20)

returns 0

been flipping that DictationSetState bit on and off the last couple of days... I set it on again.

The Cntl + A didnt trigger anything.. but thanks for highlighting how to force an event.thanks for your help so far sean.. I think though, sapi 5.1 might just be broken, as there seems to be a lot in the docs that doesnt match the tests.. A lot of these methods that are reported to be part of the classes / objects dont seem to be there???

the docs say...
Quote:
Call methods of the ISpRecognizer interface to configure or retrieve the attributes of the SR engine.

Implemented By
This interface is implemented by SAPI. Application developers use this interface but do not implement it.
How Created
There are two objects that implement this interface. These are created by applications by creating a COM object with either of the following CLSIDs:
SpInprocRecognizer (CLSID_SpInprocRecognizer)
SpSharedRecognizer (CLSID_SpSharedRecognizer)
Alternatively, the shared recognizer can be created by creating a SpSharedRecoContext (CLSID_SpSharedRecoContext), and then calling ISpRecoContext::GetRecognizer on this object to get a reference to the SpSharedRecognizer object.


If we try to create with SpInprocRecognizer or spSharedRecognizer then we at least get an object / interface reference, but then the pevent status=0 and no events are triggered.

But if we try this alternate method referenced in the docs... which I assume would be called like this...
Code:
ISpRecoContext:=    COM_CreateObject("SAPI.SpSharedRecoContext")
ISpRecognizer:=   COM_Invoke(ISpRecoContext, "GetRecognizer")

we get..
Quote:
function name: "GetRecognizer"
ERROR: unknown name (0x80020006)


I get similar results if I try...
Code:
ISpRecognizer:= COM_CreateObject("SAPI.SpSharedRecognizer")
ISpRecoContext:= COM_Invoke(ISpRecognizer,"CreateRecoContext")
          COM_Invoke(ISpRecognizer,"AudioInput", "+0" ) ;good
test:= COM_Invoke(ISpRecognizer,"GetStatus") ;unknown name
test:= COM_Invoke(ISpRecognizer,"GetRecoState") ;unknown name
          COM_Invoke(ISpRecognizer,"EmulateRecognition", "One",0,0x0409) ;silent

in this case both GetStatus and GetRecoState are unknown names , but emulateRecognition appears to be present, however it does not trigger any events.

worth noting.. ctl-alt-del and sapisvr.exe is present, so the engine is there, and if I talk in the mic, the CPU usage goes up to 40% from 5%, so it is doing something. And if I shut down autohotkey then sapi is unloaded.

makes you wonder, are the methods hardcoded somewhere? or is something changing the method call if it identifies something in the name, like 'get'?

where to go from here, Im not sure.. I find myself wondering, how can I bypass the COM lib to create a call back function myself, or construct the event callback directly without calling the COM_ConnectObject

COM_Invoke and COM in general is obviously a very very tricky piece of code....

EDIT:*** Ahh, I just discovered registerCallback(), seans tweaks to dllcall() and laszlos machine code wizardry. I think these will find a solution to the current problem, and I'll let you know the fix.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 3:44 pm 
Offline

Joined: October 17th, 2009, 8:54 pm
Posts: 43
This might be what is going on....the recoContext must be created first? and the scripting host (AHK?) is in some way a middle man?
Quote:
There are two ways for applications developers to create a recognizer and a recognition context. The first is to create a recognizer object and then to derive a recognition context from the recognizer. The other is to create a recognition context and then to derive the recognizer from the context.

But in a scripting environment, events can only be received by objects created by the scripting host. And since recognition results are received exclusively through recognition context events, consequently, in a scripting environment, the recognition context must be created first. As a further consequence, the recognizer created from the recognition context will be associated with the default SR engine.


....

I tried this next.. to see if I could capture any / all of the messages generated by the SR engine.. it didnt send any... well except for a shutdown message. the docs said the messages come in on the back of WM_USER but the SDK examples are using WM_RECOEVENT, and that doesnt seem to be defined anywhere... so I stuck with WM_USER

Code:
onMessage(WM_USER, "procSRMessage")

procSRMessage(wParam, lParam, msg, hwnd)
{
;//    ... body of function...
  static isTalking
 if(!isTalking){
  isTalking:=1
   msgBox W M User Message Detected
  isTalking:=0
 }
}


I spent some time trying to get some kind of a hook into ..SetNotifyCallbackFunction, but to no avail...

the following is probably completely wrong.. I dont know..I also tried it on the ISpRecognizer interface... was trying to see if I could get something/anything hooked into the event chain. Im not really sure how to set up the callback struct for this method.. just took a guess, I was hoping it would just crash or error or do something other than nothing.
Code:
COM_Invoke(ISpRecoContext,"SetNotifyCallbackFunction", RegisterCallback("procSRMessage" ), "+0","+0")


ah well.. I give up..I'll try again in a few weeks with direct DllCall's or maybe just make my own dll in c++.. as all the microsoft examples are working fine.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2009, 1:23 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Both route, Recognizer -> RecoContext and RecoContext -> Recognizer, should work as both had worked in my previous XPSP3, although I had tested only through EmulateRecognition. Looks like AHK is mal-functioning in your system, especially when communicating with other process, possibly it might be infected or be blocked by something. I suggest to test again with InProc engine than Shared engine.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 19th, 2010, 6:04 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Sean wrote:
Both route, Recognizer -> RecoContext and RecoContext -> Recognizer, should work

It doesn't work for me either giving the same error:
Code:
function name: "GetRecognizer"
ERROR: unknown name (0x80020006)


I am creating alternate dictation grammars using the dictation resource kit sample. Is there a com alternative to switch dictation topics ?
According to this tutorial,
here is the c# version:
Code:
SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
sre.SetInputToDefaultAudioDevice();
sre.RecognizeCompleted += new EventHandler(sre_RecognizeCompleted);
string topic = "grammar:dictation#Genre";
DictationGrammar dg = new DictationGrammar(topic);
sre.LoadGrammar(dg);
sre.RecognizeAsync();


The following fails:
Code:
COM_Init()
plistener:= COM_CreateObject("SAPI.SpSharedRecognizer")
COM_Invoke(plistener, "AudioInput", paudioin ? "+" . paudioin : "+0")
pcontext := COM_Invoke(plistener, "CreateRecoContext")

pgrammar := COM_Invoke(pcontext , "CreateGrammar")
COM_INVOKE(pgrammar, "LoadDictation", "grammar:dictation#Genre", 0)
with "LoadDictation function not found..."

Also, has anyone been able to use a wav file to test speech recognition / apps instead of a microphone using
audioinputstream?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 19th, 2010, 6:41 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tinku99 wrote:
It doesn't work for me either giving the same error:
Which OS are you on? There exist discrepancies in function names between ISp.../ISpeech... interfaces. It should be Recognizer with ISpeechRecoContext.
Quote:
"LoadDictation function not found..."
It should be DictationLoad with ISpeechRecoGrammar.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 19th, 2010, 8:06 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Sean wrote:
It should be DictationLoad with ISpeechRecoGrammar.

I am on Vista.
Ok, now it finds DictationLoad, but still doesn't find my dictation topic
Code:
COM_INVOKE(pgrammar, "DictationLoad", "grammar:dictation#Genre", 0)


Here are my registry settings:
Code:
set MODEL_PATH="%CD%\output\genre"
reg ADD HKCU\Software\Microsoft\Speech\Preferences\DictationLanguageModels /t REG_SZ /d Genre /v Genre /f
reg ADD HKLM\SOFTWARE\Microsoft\Speech\Recognizers\Tokens\MS-1033-80-DESK\Models\1033\L1033\LMs\Addon /t REG_SZ /d %MODEL_PATH% /v  Genre /f


I tried variations, nothing worked :
Code:
COM_INVOKE(pgrammar, "DictationLoad", "Genre", 0)


I am able to manually select "genre" from the speech gui...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 10:59 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tinku99 wrote:
Ok, now it finds DictationLoad, but still doesn't find my dictation topic
What you meant by not find? Did it produce an error message, or did it just recognize none? Assuming the latter, I suppose you have to activate the dictation after loading it.
Code:
COM_Invoke(pgrammar, "DictationSetState", 1)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: DictationLoad error
PostPosted: March 19th, 2010, 2:30 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Activating dictation did not help.

Sean wrote:
tinku99 wrote:
Ok, now it finds DictationLoad, but still doesn't find my dictation topic
What you meant by not find? Did it produce an error message
Yes, error:
Code:
COM Error Notification
---------------------------
Function Name:   "DictationLoad"
ERROR:      (0x8004503A)
PROG:   
DESC:   
HELP:   ,0

ERROR2:   Member not found.

   (0x80020003)


I wonder if this is even possible: Dictation Grammar Constructor
Code:
The currently support values for the URI argument to DictationGrammar(String) are
...
grammar:dictation
...
grammar:dictation#spelling
I am not sure if user defined grammars are even allowed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: DictationLoad error
PostPosted: March 19th, 2010, 4:21 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tinku99 wrote:
Yes, error:
The error message is:
Code:
; SPERR_NOT_FOUND (0x8004503A)
The requested data item (data key, value, etc.) was not found.

Quote:
I wonder if this is even possible: Dictation Grammar Constructor
Actually I was aware of the similar.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Quote:
SAPI currently defines one specialized dictation topic: SPTOPIC_SPELLING. SR engines are not required to support specialized dictation topics (including spelling). When using another manufacturer's SR engine, consult its documentation for details.
However, you mentioned a C# example with a specific topic, so I assumed it was possible as I'm currently on Win7 x64 with non-English MUI where Speech Recognition is disabled and thus can't test myself. Looks like Dictation Resource Kit should be installed for that.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: custom dictation topics
PostPosted: March 23rd, 2010, 6:31 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Actually it works.
I just modified the simpledict example in the sapi5.1 sdk with:
Code:
hr = m_cpDictationGrammar->LoadDictation(L"Genre", SPLO_STATIC);
thanks to a hint at stackoverflow

DictationLoad works through COM / ahk also. I had stupidly forgotten that i had renamed the directory containing my "Genre" language model.

This is nice because you can parse fast dictation with ahk to detect commands instead of having to pause for command recognition.
Code:
#Persistent
OnExit, CleanUp

COM_Init()
plistener:= COM_CreateObject("SAPI.SpSharedRecognizer")
COM_Invoke(plistener, "AudioInput", paudioin ? "+" . paudioin : "+0")
pcontext := COM_Invoke(plistener, "CreateRecoContext")

pgrammar := COM_Invoke(pcontext , "CreateGrammar")

COM_INVOKE(pgrammar, "DictationLoad", "Genre", 0)
COM_Invoke(pgrammar, "DictationSetState", 1)

pevent := COM_ConnectObject(pcontext, "On")
Return

CleanUp:
COM_Release(pevent)
COM_Release(pstate)
COM_Release(prulec)
COM_Release(prules)
COM_Release(pgrammar)
COM_Release(pcontext)
COM_Release(plistener)
COM_Term()
ExitApp

OnRecognition(prms, this)
{
   presult := COM_DispGetParam(prms, 3, 9)
   pphrase := COM_Invoke(presult, "PhraseInfo")
   sText   := COM_Invoke(pphrase, "GetText")
   COM_Release(pphrase)
   ToolTip, % sText
;   Add custom operations from here!
}

!r::reload
!q::exitapp
#Include com.ahk


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Kirtman, Rseding91, Yahoo [Bot] and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group