VoxCommando
New Features and Feature Requests => Feature Requests => Topic started by: Haddood on July 30, 2014, 09:04:35 PM
-
By any chance there is undocumented VC.GetOption command? ::hmm ::hmm ::hmm
I am doing it with 2 commands, but it would be much nicer VC.GetOption
File.Read options.xml
Results.RegEx Option\sname="PrefixString"\svalue="(.*)"
-
The way you are doing it is fine. I don't see a big benefit to making an action to do the same thing. It would not be noticeably faster.
Keep in mind that you are only reading the option as stored in the xml which may not be the same as the options that might have been temporarily overridden.
-
Keep in mind that you are only reading the option as stored in the xml which may not be the same as the options that might have been temporarily overridden.
That is exactly why it is needed 8) 8)
-
When is your birthday? ;)
-
When is your birthday? ;)
I celebrate it every month :biglaugh :biglaugh :biglaugh
but if you are serious about a birthday gift, I would love to have an event when a command recognized with the phrase and confidence as payloads 8) 8) 8)
-
OK, I guess you will get a birthday and a Christmas present then.
Or a {insertYourPreferredChristmasAlternativeHere} present if you don't celebrate Christmas... :D
-
OK. Here is your OSD solution. Use this python code. Auto-load it when VC starts. Problem solved.
from System.Collections.Generic import *
def osdEvent(osdInfo):
strText = unicode(osdInfo.speechText)
strCommandName = unicode(osdInfo.commandName)
strGroup = unicode(osdInfo.groupName)
strConfidence= str(osdInfo.confidence)
strPass = str(osdInfo.confidencePassed)
strDoingCommand=str(osdInfo.doingCommand)
vc.triggerEvent("VC.Reco", List[str]([strText, strCommandName, strGroup, strConfidence, strPass, strDoingCommand]))
vc.OnOSD -= osdEvent
vc.OnOSD += osdEvent
Note that this code will generate an event any time speech is recognized, whether it is executed or not. If you want you can use an if statement to make it only execute if (osdInfo.confidencePassed==false) or whatever. You could also change the event name to include information from one of the variables to get "VC.Reco.True" or "VC.Reco.False" or "VC.Reco.GroupName" etc.
If there are variables in there that you don't need you can remove them to make it a bit more efficient.
Note the difference between osdInfo.confidencePassed and osdInfo.doingCommand. You may pass the confidence test, but still not execute the command for various reasons, like being in standby, or there being too many alternates.
Note that the object does not contain any information about prefix, other than the actual speechText.
[Code box updated 14-Oct-2015 to address character encoding problem. See thread discussion here: http://voxcommando.com/forum/index.php?topic=1689.msg20320#msg20320]
-
first let me say ::bow ::bow
OK, I guess you will get a birthday and a Christmas present then.
Or a {insertYourPreferredChristmasAlternativeHere} present if you don't celebrate Christmas... :D
if it comes to VC features as presents I will celebrate even the undiscovered Amazonian tribes special days :biglaugh :biglaugh
-
hmmm, even stretch-your-lip-up-over-the-top-of-your-head day?
-
hmmm, even stretch-your-lip-up-over-the-top-of-your-head day?
this one I will pass cause VC will find hard time understanding me !!!
-
Hello everyone.
I want to use the script like in
http://voxcommando.com/forum/index.php?topic=1845.0 (http://voxcommando.com/forum/index.php?topic=1845.0)
but it comes up with the following error:
System.Text.DecoderFallbackException: Die Bytes [F6] im Index 0 können nicht von der angegebenen Codepage in Unicode übersetzt werden.
bei System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
bei System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)
bei IronPython.Runtime.PythonAsciiEncoding.GetCharCount(Byte[] bytes, Int32 index, Int32 count)
bei System.Text.Encoding.GetChars(Byte[] bytes, Int32 index, Int32 count)
bei System.Text.Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)
bei IronPython.Runtime.Operations.StringOps.DoDecode(CodeContext context, String s, String errors, String encoding, Encoding e)
bei IronPython.Runtime.Operations.StringOps.RawDecode(CodeContext context, String s, Object encodingType, String errors)
bei IronPython.Runtime.Operations.StringOps.__new__(CodeContext context, PythonType cls, Object string, String encoding, String errors)
bei IronPython.Runtime.Operations.StringOps.CheckAsciiString(CodeContext context, String s)
bei IronPython.Runtime.Operations.StringOps.__new__(CodeContext context, PythonType cls, String object)
bei Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
bei System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
bei Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
bei IronPython.Compiler.PythonCallTargets.OriginalCallTarget1(PythonFunction function, Object arg0)
bei System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
bei _Scripting_(Object[] , osdInfo )
bei PluginInterface.doOsdEvent.Invoke(osdInfo oInfo)
bei VoxCommando.PluginServices.fireOsdEvent(osdInfo oInfo)
bei eval_f.eval_ᜀ(Object A_0, SpeechRecognizedEventArgs A_1)
13.10.2015 21:03:43 424 [error] unexpected error:
System.Text.DecoderFallbackException: Die Bytes [F6] im Index 0 können nicht von der angegebenen Codepage in Unicode übersetzt werden.
bei System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
bei System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)
bei IronPython.Runtime.PythonAsciiEncoding.GetCharCount(Byte[] bytes, Int32 index, Int32 count)
bei System.Text.Encoding.GetChars(Byte[] bytes, Int32 index, Int32 count)
bei System.Text.Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)
bei IronPython.Runtime.Operations.StringOps.DoDecode(CodeContext context, String s, String errors, String encoding, Encoding e)
bei IronPython.Runtime.Operations.StringOps.RawDecode(CodeContext context, String s, Object encodingType, String errors)
bei IronPython.Runtime.Operations.StringOps.__new__(CodeContext context, PythonType cls, Object string, String encoding, String errors)
bei IronPython.Runtime.Operations.StringOps.CheckAsciiString(CodeContext context, String s)
bei IronPython.Runtime.Operations.StringOps.__new__(CodeContext context, PythonType cls, String object)
bei Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
bei System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
bei Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
bei IronPython.Compiler.PythonCallTargets.OriginalCallTarget1(PythonFunction function, Object arg0)
bei System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
bei _Scripting_(Object[] , osdInfo )
bei PluginInterface.doOsdEvent.Invoke(osdInfo oInfo)
bei VoxCommando.PluginServices.fireOsdEvent(osdInfo oInfo)
bei eval_f.eval_ᜀ(Object A_0, SpeechRecognizedEventArgs A_1)
I use Windows 10 Prof 64bit
All other things works fine
Thank you in advanced
Chris
-
Please post the code you are using that generates that error. It if it python please post the python code and if it is a command please post the xml. It is really not clear from the link you provided what you are actually doing.
-
Hey James,
I use your python code from this topic
http://voxcommando.com/forum/index.php?topic=1689.msg14686#msg14686
So the used Pythoncode is
from System.Collections.Generic import *
def osdEvent(osdInfo):
strText = str(osdInfo.speechText)
strCommandName = str(osdInfo.commandName)
strGroup = str(osdInfo.groupName)
strConfidence= str(osdInfo.confidence)
strPass = str(osdInfo.confidencePassed)
strDoingCommand=str(osdInfo.doingCommand)
vc.triggerEvent("VC.Reco", List[str]([strText, strCommandName, strGroup, strConfidence, strPass, strDoingCommand]))
vc.OnOSD -= osdEvent
vc.OnOSD += osdEvent
I Hope it helps
-
nime5ter figured out that it was having trouble dealing with accented characters in either your command name or phrases. The str() function is not able to cope with them.
Using the unicode() function instead seems to solve the problem, at least in my simple tests.
Try this python code:
from System.Collections.Generic import *
def osdEvent(osdInfo):
strText = unicode(osdInfo.speechText)
strCommandName = unicode(osdInfo.commandName)
strGroup = unicode(osdInfo.groupName)
strConfidence= str(osdInfo.confidence)
strPass = str(osdInfo.confidencePassed)
strDoingCommand=str(osdInfo.doingCommand)
vc.triggerEvent("VC.Reco", List[str]([strText, strCommandName, strGroup, strConfidence, strPass, strDoingCommand]))
vc.OnOSD -= osdEvent
vc.OnOSD += osdEvent
-
:yay :yay
Thank you Boys. It works great. Another step to my perfect Voxcontrolled home.
Kind regards Chris