AppleScript Speech Recognition Server 监听任何响应

标签 applescript

好的,目前,我有一个如下所示的脚本:

tell application "SpeechRecognitionServer"
    set theResponse to listen for {"Mark"} with prompt "What is your name?"
end tell

但是,我不希望它监听特定的关键字。我希望它从该提示中收集语音数据并将其转换为可以存储在数据库中的字符串。

例如,系统会提示用户“你叫什么名字?”这个口头问题。然后,他们会说出自己的名字,说“Mark”,语音识别服务器会捕获该输入,将其翻译成文本,并将其存储为变量,(userName = theResponse;)

这可能吗?现在我只看到监听关键字的选项,这对于我想要实现的目标来说是不可取的。

感谢您提供的所有帮助。

最佳答案

正如 Garrett 所说,我所做的是使用对话框来输入文本。默认的语音命令键是双击“fn”键。

tell application "Finder"
say "Which application would you like me to open?" using "Alex"
end tell
set theOpen to text returned of (display dialog "Press the 'fn' key twice and speak!" default answer "" buttons {"Cancel", "Ok"} default button 2)
tell application "Finder"
say "Ok! I will open " & theOpen & " for you" using "Alex"
end tell
tell application theOpen
activate
end tell

关于AppleScript Speech Recognition Server 监听任何响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14026565/

相关文章:

youtube - Applescript 将音频文件添加到主题演讲并将文件上传到 YouTube

objective-c - 以编程方式修改 osx 中的屏幕边界

directory - 从 AppleScript 路径中提取文件扩展名

bash - 从 OS X 中的 bash 脚本,是否可以提示管理员权限?

node.js - Express 中的查询参数被提取?

applescript - Applescript 中的击键 Fn(功能)键

applescript - 如何制作每次打开都不需要许可的脚本

macos - 使用 Applescript 退出所有应用程序?

applescript - 在 Applescript 中,从 Spotify 检索播放列表信息,并启用/禁用随机播放

macos - 在 applescript 中将窗口置于前面