Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取JS托管Web应用程序中Cortana的编号_Javascript_Uwp_Cortana - Fatal编程技术网

Javascript 获取JS托管Web应用程序中Cortana的编号

Javascript 获取JS托管Web应用程序中Cortana的编号,javascript,uwp,cortana,Javascript,Uwp,Cortana,我正在尝试让Cortana在我的托管Web应用程序中工作。然而,我陷入了一个问题,我没有得到用户与Cortana交谈的文本。以下是应该发生的事情: 如果用户说“ChangeWindows show build 14393”,应用程序应打开并导航到地址“/build/14393”。然而,我不知道如何得到这个数字。以下是我现在掌握的代码: vcd.xml文件 <?xml version="1.0" encoding="utf-8"?> <VoiceCommands xmlns="h

我正在尝试让Cortana在我的托管Web应用程序中工作。然而,我陷入了一个问题,我没有得到用户与Cortana交谈的文本。以下是应该发生的事情:

如果用户说“ChangeWindows show build 14393”,应用程序应打开并导航到地址“/build/14393”。然而,我不知道如何得到这个数字。以下是我现在掌握的代码:

vcd.xml文件

<?xml version="1.0" encoding="utf-8"?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2">
    <CommandSet xml:lang="en-us" Name="ChangeWindowsPreview">
        <CommandPrefix>ChangeWindows</CommandPrefix>
        <Example>Navigate to a changelog, milestone or build</Example>

        <Command Name="OpenBuild">
            <Example>Show build 14393</Example>
            <ListenFor RequireAppName="BeforeOrAfterPhrase">Show [build] {build}</ListenFor>
            <Feedback>Opening build {build} with ChangeWindows</Feedback>
            <Navigate />
        </Command>

        <Command Name="OpenNext">
            <Example>Show the next major release</Example>
            <ListenFor RequireAppName="BeforeOrAfterPhrase">Show [the] next [major] [feature] [release]</ListenFor>
                <Feedback>Opening vNext with ChangeWindows</Feedback>
        <Navigate />
        </Command>

        <PhraseTopic Label="build" Scenario="Dictation"></PhraseTopic>
    </CommandSet>
</VoiceCommands>

换窗
导航到变更日志、里程碑或构建
显示构建14393
显示[build]{build}
使用ChangeWindows打开生成{build}
显示下一个主要版本
显示[下一个[主要][功能][发布]
使用ChangeWindows打开vNext
对于我的JS,我有:

    <script type="text/javascript">            
    if ( typeof Windows !== 'undefined' ) {            
        var activation = Windows.ApplicationModel.Activation;
        
        Windows.UI.WebUI.WebUIApplication.addEventListener("activated", function (args) {
            if ( args.kind === activation.ActivationKind.voiceCommand ) {
                var speechRecognitionResult = args.result;

                if ( speechRecognitionResult.rulePath[0] === "OpenBuild" ) {
                    console.log( "Opening this build from Cortana: " + speechRecognitionResult.text );
                    window.location.replace( "/build/" + speechRecognitionResult.text );
                }

                if ( speechRecognitionResult.rulePath[0] === "OpenNext" ) {
                    console.log( "Opening next feature release with Cortana" );
                    window.location.replace( "/build/next" );
                }
            }
        })
}
    </script>

如果(窗口的类型!==“未定义”){
var activation=Windows.ApplicationModel.activation;
        
Windows.UI.WebUI.WebUIApplication.addEventListener(“已激活”),函数(args){
if(args.kind==activation.ActivationKind.voiceCommand){
var speechRecognitionResult=args.result;
if(speechRecognitionResult.rulePath[0]=“OpenBuild”){
log(“从Cortana打开此构建:+speechRecognitionResult.text”);
window.location.replace(“/build/”+speechRecognitionResult.text);
                }
if(speechRecognitionResult.rulePath[0]=“OpenNext”){
log(“使用Cortana打开下一个特性发布”);
window.location.replace(“/build/next”);
                }
            }
        })
}
    

所以,很明显,“speechRecognitionResult.text”不是我在这里要找的。但是我希望有人知道应该在那里获取{build}。

为什么不使用带有特定项的
短语列表
,而不是
短语主题
短语列表
只用于预定义值,对吗?这些数字是随机数。