Advertisement
aclermike

Connect and disconnect BT device on Macbook

Jan 7th, 2021
2,988
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tell application "System Events" to tell process "SystemUIServer"
  2.     set bt to (first menu bar item whose description is "bluetooth") of menu bar 1
  3.     click bt
  4.     tell (first menu item whose title is "AirPods Pro") of menu of bt
  5.         click
  6.         tell menu 1
  7.             if exists menu item "Connect" then
  8.                 click menu item "Connect"
  9.             else
  10.                 click menu item "Disconnect"
  11.             end if
  12.         end tell
  13.     end tell
  14. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement