Forked from ieatfood/Connect Airpods.applescript
Last active
November 12, 2024 17:36
-
-
Save davidsharp/725fff254801592ea56c3870c158dc72 to your computer and use it in GitHub Desktop.
Revisions
-
davidsharp revised this gist
Nov 15, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,4 +30,4 @@ if [[ "$1" = "pair" ]]; then pair fi echo "ᚼᛒ|bash=$0 param1=pair terminal=false" -
davidsharp revised this gist
Nov 15, 2023 . No changes.There are no files selected for viewing
-
davidsharp renamed this gist
Nov 15, 2023 . 1 changed file with 12 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,11 @@ #!/bin/bash function pair(){ osascript <<'END' use framework "IOBluetooth" use scripting additions set blueToothDevice to "Buds Pro" on getFirstMatchingDevice(deviceName) repeat with device in (current application's IOBluetoothDevice's pairedDevices() as list) @@ -22,4 +23,11 @@ on toggleDevice(device) end if end toggleDevice return toggleDevice(getFirstMatchingDevice(blueToothDevice)) END } if [[ "$1" = "pair" ]]; then pair fi echo "BT|bash=$0 param1=pair terminal=false" -
ieatfood revised this gist
Jun 27, 2021 . 1 changed file with 25 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,25 @@ # Taken from https://www.reddit.com/r/MacOS/comments/i4czgu/big_sur_airpods_script/gck3gz3/ # by https://github.com/smithumble use framework "IOBluetooth" use scripting additions set AirPodsName to "AirPods" on getFirstMatchingDevice(deviceName) repeat with device in (current application's IOBluetoothDevice's pairedDevices() as list) if (device's nameOrAddress as string) contains deviceName then return device end repeat end getFirstMatchingDevice on toggleDevice(device) if not (device's isConnected as boolean) then device's openConnection() return "Connecting " & (device's nameOrAddress as string) else device's closeConnection() return "Disconnecting " & (device's nameOrAddress as string) end if end toggleDevice return toggleDevice(getFirstMatchingDevice(AirPodsName)) -
jaredmoody revised this gist
Dec 11, 2020 . 1 changed file with 8 additions and 17 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,10 @@ tell application "System Events" tell process "ControlCenter" set bt to (first menu bar item whose title is "Bluetooth") of menu bar 1 click bt set btCheckbox to checkbox 1 of scroll area 1 of group 1 of window "Control Center" whose title contains "AirPods Pro" set btCheckboxValue to value of btCheckbox tell btCheckbox to click tell bt to click end tell end tell -
jaredmoody created this gist
Nov 7, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ 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 "Jared'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 -- Close main BT drop down if Connect wasn't present return "Connect menu was not found, are you already connected?" end if end tell end tell end tell end tell