我想在TEXT模式下使用我的自定义Cortana命令"Notepad" .例如,按下WIN + S并输入"appname Notepad Example sentence!".
(这将打开记事本并输入"例句!".)
记事本命令已经在VOICE模式下工作:当我按下WIN + C并说"appname Notepad Example sentence!"时,我的记事本脚本与有效负载一起运行"例句!".
当我按下WIN + S并输入"appname Notepad Example sentence!"时,SpeechRecognitionResult的text属性为"Notepad ..."(与语音相反,它是"Notepad Example sentence!",如预期的那样).
<Command Name="notepad">
<Example> Notepad Example Sentence! </Example>
<ListenFor> Notepad {wildcardArgs} </ListenFor>
<Feedback> Notepadding {wildcardArgs} </Feedback>
<Navigate/>
</Command>
<PhraseTopic Label="wildcardArgs" Scenario="Dictation">
<!--<Subject>Wildcard</Subject>-->
</PhraseTopic>
Run Code Online (Sandbox Code Playgroud)
public static CortanaCommand ProcessCommand(SpeechRecognitionResult speechRecognitionResult, CommandDiagnostics diagnostics)
{
// Get the name of the voice command and the raw text
string voiceCommandName = speechRecognitionResult.RulePath[0];
string text …Run Code Online (Sandbox Code Playgroud)