我最近开始接触 windows 语音宏,它允许您为 windows 语音识别制作自定义命令。目前,我只能对它说一件事,它可以响应并执行命令,但我希望它像 OK GOOGLE 一样,我首先说出它的名字,然后它为实际命令做好准备,除非我说取消,这是我所拥有的示例: (我的系统称为 J-SIB,它称我为 Vulpix.JS)
<?xml version="1.0" encoding="UTF-16"?>
<speechMacros>
<command>
<listenFor>Jay Sib, Start Chrome</listenFor>
<speak>Yes Sir, Mister Vulpix Dot Jay Es</speak>
<run command="C:\Users\Programming\Desktop\Chrome.exe"/>
</command>
</speechMacros>
但我希望它是这样的:
<?xml version="1.0" encoding="UTF-16"?>
<speechMacros>
<command>
<listenFor>Jay Sib</listenFor>
<speak>Yes Sir?</speak>
<listenFor>Start Chrome</listenFor>
<speak>Yes Sir, Mister Vulpix Dot Jay Es</speak>
<run command="C:\Users\Programming\Desktop\Chrome.exe"/>
</command>
</speechMacros>
我怎么能在我不说命令的地方得到它呢?因为每当我尝试上面的命令时,它都会说有错误。
"Element 'listenFor' is unexpected according to the content model of the parent element 'command'. Expecting: sendKeys, insertText, run, emulateRecognition, waitFor, speak, alert, confirm, setTextFeedback, script, wmpMediaPlay, WmpMed..."
(你可能会问说出整个命令有什么问题,我只是不太喜欢它,我希望它像 OK GOOGLE 一样)
最佳答案
错误告诉您不能按该顺序放置标签。所有的 listenFor
标签必须彼此相邻,并且它们中的任何一个都会触发相同的命令。
您可能需要将其拆分为如下两个命令。
<?xml version="1.0" encoding="UTF-16"?>
<speechMacros>
<command>
<listenFor>Jay Sib</listenFor>
<speak>Yes Sir?</speak>
</command>
<command>
<listenFor>Start Chrome</listenFor>
<speak>Yes Sir, Mister Vulpix Dot Jay Es</speak>
<run command="C:\Users\Programming\Desktop\Chrome.exe"/>
</command>
</speechMacros>
关于xml - Speech Macro XML 中有多个 listenFor 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30429034/