我在计算机上所做的大约 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

