Nov 28th, 2020 (edited)
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set AirPodsName to "NitroAirPods Pro"
  2. tell application "System Events"
  3.     tell application process "ControlCenter"
  4.         set btMenu to menu bar item "Bluetooth" of menu bar 1
  5.         tell btMenu to click
  6.         set btCheckbox to checkbox 1 of scroll area 1 of group 1 of window "Control Centre" whose title contains AirPodsName
  7.         set btCheckboxValue to value of btCheckbox
  8.         tell btCheckbox to click
  9.         tell btMenu to click
  10.     end tell
  11. end tell
RAW Paste Data