Created
May 15, 2019 20:46
-
-
Save kevin-funderburg/e980d63f4f16c91e2c50e710aed1fec3 to your computer and use it in GitHub Desktop.
Toggle bluetooth on and off.
This file contains 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
tell application "System Events" to tell process "SystemUIServer" | |
set bt to (first menu bar item whose description is "bluetooth") of menu bar 1 | |
click bt | |
tell menu of bt | |
if exists menu item "Turn Bluetooth On" then | |
click menu item "Turn Bluetooth On" | |
else if menu item "Turn Bluetooth Off" exists then | |
click menu item "Turn Bluetooth Off" | |
else | |
key code 53 --escape | |
end if | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment