如何防止或延长 AppleEvent 或 SpeechRecognitionServer 超时?
how to prevent or extend AppleEvent or SpeechRecognitionServer timed out?
我正在做一个 SpeechRecognition 项目,我已经差不多完成了。但是,有一件事我不太明白。当我启动我的应用程序时,它会听取我的命令,如果我保持安静或不说命令,那么它会给我这个脚本错误:
它超时了。我希望它 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
我正在做一个 SpeechRecognition 项目,我已经差不多完成了。但是,有一件事我不太明白。当我启动我的应用程序时,它会听取我的命令,如果我保持安静或不说命令,那么它会给我这个脚本错误:
这是我的代码:
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