; Load the HotVoice Library
; Create a new HotVoice class
hv := new HotVoice()
; Initialize HotVoice and tell it what ID Recognizer to use
; Create a new Grammar
testGrammar := hv.NewGrammar()
; Add the word "Test" to it
; Load the Grammar
hv.LoadGrammar(testGrammar, "Test", Func("MyFunc"))
ToolTip % "Command: " grammarName " was triggered @ " A_TickCount " with " words.Length() " words"
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at HotVoice.Recognizer_SpeechRecognized(Object sender, SpeechRecognizedEventArgs e)
at Microsoft.Speech.Recognition.SpeechRecognitionEngine.SpeechRecognizedProxy(Object sender, SpeechRecognizedEventArgs e)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
at System.Delegate.DynamicInvokeImpl(Object args)
at Microsoft.Speech.Internal.AsyncSerializedWorker.WorkerProc(Object ignored)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
Is there any way to use both ?
.SubscribeWord with two-worded commands and .SubscribeWordWithChoiceList
@SpecialGuest if you put a hyphen between two-words, it seems to count as one
I have learned a ton since I did the first version, what I am working on now does not suffer from the same problem.
The whole project is in a high state of flux at the moment, trying to work out how to provide max flexibility but also not force too much complexity on the user - not sure how long those old methods will last and if it is worth going back and fixing them...
Tinkering around today, I think I have hit upon a solution which is simpler - that whole "GrammarVar" system just did not quite gel for me.
Unfortunately, COM does not seem to support variable number of parameters in a function call, but I am experimenting with the idea of 10 parameter functions with optional parameters as a work-around.
This allows you to work in AHK with objects, build them up using AHK variables, and then load the finished result into the recognizer.
I am not sure you are gonna be wanting to add more than 10 grammar branches in a node, and we can always maybe add more.
This would not affect Choices - you can add a choice list of arbitrary length.
Hi, I get this error and the PowerShell command doesn't cure it. I tried running it in the script folder and the lib folder.
EDIT: AHK_L 1.1.28.02 U64, Win7 SP1 64-bit
EDIT: I had long ago changed references to "null" in CLR.ahk to "nulo" for the same reason you mention in the script, AHK_H compatibility. I commented out the CLR section in the script and referenced my own lib, but got the same result (which seems only logical).
HotVoice.dll failed to load
Dll may be blocked. Try running the powershell command
Get-ChildItem -Path '.' -Recurse | Unblock-File
in the script folder