Applescript 如何防止或扩展AppleeEvent或SpeechRecognitionServer超时?

Applescript 如何防止或扩展AppleeEvent或SpeechRecognitionServer超时?,applescript,runtime-error,speech-recognition,applescript-objc,appleevents,Applescript,Runtime Error,Speech Recognition,Applescript Objc,Appleevents,我正在做一个演讲认可项目,我已经差不多完成了。然而,有一件事我不太明白。当我启动应用程序时,它会监听我的命令,如果我保持安静或不说出命令,则它会给我以下脚本错误: 它正在超时。我希望它24小时开放,即使我什么也没说 这是我的代码: tell application "SpeechRecognitionServer" with timeout of 10000 seconds set FRIDAY_AI to listen for commands end time

我正在做一个演讲认可项目,我已经差不多完成了。然而,有一件事我不太明白。当我启动应用程序时,它会监听我的命令,如果我保持安静或不说出命令,则它会给我以下脚本错误: 它正在超时。我希望它24小时开放,即使我什么也没说

这是我的代码:

tell application "SpeechRecognitionServer"
    with timeout of 10000 seconds
        set FRIDAY_AI to listen for commands
    end timeout
end tell
如果你能帮我解决这个问题,我将非常感激


谢谢大家!

我在电脑上所做的每件事,大约70%都是由听写命令和我自己定制的听写命令控制的。一旦你掌握了窍门,它就会变得非常强大。我用一个小脚本和几个示例为您设置,让SpeechRecognitionServer应用程序不断地侦听一组要执行的口头命令。我认为,通过查看代码,可以根据您的需要对其进行调整,这是非常不言自明的

在脚本编辑器中,将以下代码另存为保持打开的应用程序。确保将系统首选项中的新应用添加到允许控制计算机的应用列表中。现在你需要做的就是启动你的新应用程序

on idle
    try
        tell application "SpeechRecognitionServer"
            set theChoice to listen continuously for ¬
                {"Open Google", "Close Windows", "Enter Name", "Enter Password", "Close My Commands"} ¬
                    with identifier "mine" with section title "WeeeHaaa's Commands"

            if theChoice is "Open Google" then
                tell application "Google Chrome" to activate
            else if theChoice is "Close Windows" then
                tell application "Finder" to close windows
            else if theChoice is "Enter Name" then
                set myFullname to "Crazy Eddie"
                tell application "System Events"
                    keystroke myFullname
                end tell
            else if theChoice is "Enter Password" then
                set myPassword to "secretpassword"
                tell application "System Events"
                    keystroke myPassword
                end tell
            else if theChoice is "Close My Commands" then
                quit me
            end if

        end tell
    end try
    return 0.5
end idle

on quit
    -- stop listening
    tell application "SpeechRecognitionServer"
        stop listening for identifier "mine"
    end tell
    continue quit
end quit


您可以尝试
连续收听
,为它提供一个标识符,用于
停止收听标识符
——这对我来说是一个相当大的下载量。您能再解释一下吗,也许可以举例说明您的意思。非常感谢。我没有1.2GB的下载来运行语音识别,但请查看SpeechRecognitionServer的脚本字典中的术语。您好,感谢您提供这段代码!我试过了,当我运行它时,不到一秒钟它就退出了。我一运行它就结束了。我已经将它添加到可以控制我的计算机的应用程序列表中。我在我的原始代码中添加了“continuously”,但出现了以下错误:SpeechRecognitionServer出现错误:{“复制链接”、“粘贴链接”、“给我正在运行的应用程序列表”、“打开文件夹”、“打开chrome”}不理解“持续侦听”消息。好的,让我们尝试隔离问题。在脚本编辑器应用程序中,将我的帖子中的代码原封不动地保存为“保持打开”应用程序。如果不将其保存为“保持打开”应用程序,它将无法工作。通过脚本编辑器应用程序运行代码也不起作用。像运行任何其他应用程序一样运行应用程序。。。在Finder中双击它。带有自定义命令的听写命令窗口现在应该打开。现在说出其中一些命令,看看它们是否有效。无论您是否启用了增强的听写命令,这都不会有任何区别。如果上述步骤起作用,请返回脚本编辑器,确保您的“保持打开”应用程序不再运行,并用您的命令替换“我的”命令。在脚本编辑器中重新保存该文件。再次,在Finder中,双击应用程序并再次测试命令是否有效!!!!!!!非常感谢!!!!!我真的很感激你花时间帮我解决这个问题,再次感谢你!