Skip to content

Instantly share code, notes, and snippets.

@evantravers
Created January 3, 2019 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evantravers/fbbe9c7482267b6fc7864f00bdb5dba6 to your computer and use it in GitHub Desktop.
Save evantravers/fbbe9c7482267b6fc7864f00bdb5dba6 to your computer and use it in GitHub Desktop.
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
tell btMenu
click
tell (menu item "Evan’s AirPods" of menu 1)
click
if exists menu item "Connect" of menu 1 then
click menu item "Connect" of menu 1
return "Connecting..."
else
click btMenu
return "Connect menu was not found, are you already connected?"
end if
end tell
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment