我想我没有做到这一点,这就是我所拥有的......
tell application "SpeechRecognitionServer"
with timeout of (1.0E+9 * 100000000) seconds
set theResponse to listen for text returned of {say "What do I have to type for you?"} with timeout of 30 seconds
end timeout
tell application "System Events"
keystroke (theResponse)
end tell
end timeout
end tell
我想让Applescript输入我说的内容,所以如果我说"你好",那个Applescript类型"你好"等
答案 0 :(得分:0)
你不能用SpeechRecognitionServer
做到这一点,但是在Mountain Lion及更高版本中有使用Dictation的解决方法。
启用听写并运行它,它会显示一个文本字段为“监听器”的对话框,
完成听写后按return
。将打开TextEdit并输入文本。
say "What do I have to type for you?" using "Alex"
set theResponse to text returned of (display dialog "Press 'fn' twice and speak!" default answer "" buttons {"Cancel", "Ok"} default button 2)
activate application "TextEdit"
tell application "System Events" to keystroke theResponse