How can I make applescript voice recognition listen for any word?

微笑、不失礼 提交于 2019-12-08 04:39:21

问题


How can I make applescript voice recognition listen for any word? This is what I have so far:

tell application "System Events"
    keystroke "c" using {command down}
end tell

tell application "iCal" to activate

tell application "System Events"
        keystroke "n" using {command down}
    keystroke "v" using {command down}
    keystroke return
end tell

I would like to substitute the copy on the first line to listen for any words.


回答1:


tell application "SpeechRecognitionServer"
    set answer to listen for {"yes", "no"} with prompt "prompt"
    --hold the listening key (by default escape) to record an answer
end tell

Speakable items have to be enabled first:

See http://macscripter.net/viewtopic.php?id=24662 for more detailed instructions.



来源:https://stackoverflow.com/questions/7675146/how-can-i-make-applescript-voice-recognition-listen-for-any-word

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!