【问题标题】:How to open Bluetooth "Edit Serial Ports" on OSX with Applescript?如何使用 Applescript 在 OSX 上打开蓝牙“编辑串行端口”?
【发布时间】:2014-07-09 06:54:33
【问题描述】:

我正在尝试在 OSX 7 上编写一个 AppleScript,它只是在蓝牙首选项菜单中打开“编辑串行端口”选项(我只有一个配对设备)。我能够一直到蓝牙首选项窗格,但我被困在如何告诉 applescript 从下拉菜单中选择适当的选项。有人能帮我解决这个问题吗?

到目前为止的applescript:

tell application "System Preferences"
    activate
end tell

tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preferences.Bluetooth"
end tell

非常感谢您分享您的知识和专业知识!

【问题讨论】:

    标签: bluetooth serial-port applescript osx-lion


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 2016-01-28
      • 2018-11-13
      • 2016-02-21
      • 1970-01-01
      • 2012-06-27
      • 1970-01-01
      • 1970-01-01
      • 2014-12-22
      • 2021-11-22
      相关资源
      最近更新 更多