Created
September 7, 2022 17:06
-
-
Save glightfoot/16952a9cef34707bb2068f4b9df42e2c to your computer and use it in GitHub Desktop.
Connect to airpods pro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
activate application "SystemUIServer" | |
local isConnected | |
tell application "System Events" | |
tell process "SystemUIServer" | |
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth") | |
set isConnected to false | |
tell btMenu | |
click | |
set airPods to (menu item 1 of menu 1 whose name contains "AirPods Pro") | |
tell airPods | |
click | |
if exists menu item "Connect" of menu 1 then | |
click menu item "Connect" of menu 1 | |
else | |
set isConnected to true | |
end if | |
end tell | |
if isConnected then | |
key code 53 | |
end if | |
end tell | |
end tell | |
end tell | |
#delay 1 | |
#set airpods_battery to do shell script "/Volumes/case_sensitive/projects/misc-scripts/scripts/airpods_battery" | |
#return airpods_battery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment