我正在尝试在OSX 7上编写一个只打开"编辑串行端口"蓝牙首选项菜单中的选项(我只有一个配对设备)。我能够一直到蓝牙首选项窗格,但我仍然坚持如何告诉applescript从下拉菜单中选择适当的选项。有人能帮我这个吗?
到目前为止的苹果:
tell application "System Preferences"
activate
end tell
tell application "System Preferences"
activate
set current pane to pane "com.apple.preferences.Bluetooth"
end tell
非常感谢您分享您的知识和专业知识!
答案 0 :(得分:1)
我能够回答我自己的问题,并在此过程中学到了很多关于applescript和xcode的知识。正确的脚本如下:
tell application "System Preferences"
set current pane to pane id "com.apple.preferences.bluetooth"
tell application "System Events"
tell process "System Preferences"
click menu button "Perform tasks with the selected device" of splitter group 1 of group 1 of window "Bluetooth"
delay 1 -- give menu time to pop up
click menu item "Edit Serial Ports…" of menu 1 of menu button "Perform tasks with the selected device" of splitter group 1 of group 1 of window "Bluetooth"
delay 5
end tell
end tell
quit
end tell