我需要使用AppleScript自动化FaceTime呼叫,但我的要求之一是选择一个特定的网络摄像头。我正在尝试使用这个代码:
tell application "System Events"
tell process "FaceTime"
tell menu bar 1
tell menu bar item "Video"
click menu item "Webcam 520X"
end tell
end tell
end tell
end tell
但是我得到了这个错误信息:
系统事件发生错误:无法获取FaceTime进程的菜单栏1的菜单栏项"视频"的菜单项"Webcam 520X"
有什么好的建议吗?谢谢!
在menu item
和menu bar item
之间总是存在一个menu
引用
activate application "FaceTime"
tell application "System Events"
tell process "FaceTime"
tell menu bar 1
tell menu bar item "Video"
tell menu 1
click menu item "Webcam 520X"
end tell
end tell
end tell
end tell
end tell
或
activate application "FaceTime"
tell application "System Events"
tell process "FaceTime"
click menu item "Webcam 520X" of menu 1 of menu bar item "Video" of menu bar 1
end tell
end tell