我正在尝试创建一个 applescript 以允许我通过蓝牙 ID 连接到蓝牙设备。
到目前为止,如果蓝牙关闭,我已经设法获得一个applescript来打开蓝牙。这是代码:
# This is only necessary, if AppleScripts are not yet allowed to change checkboxes
tell application "System Events" to set UI elements enabled to true
# Now change the bluetooth status
tell application "System Preferences"
set current pane to pane id "com.apple.preferences.bluetooth"
tell application "System Events"
tell process "System Preferences"
# Enabled is checkbox number 2
if value of checkbox 2 of window "Bluetooth" is 0 then
click checkbox 2 of window "Bluetooth"
end …Run Code Online (Sandbox Code Playgroud)