Created
December 20, 2012 04:19
-
-
Save jondkinney/4342948 to your computer and use it in GitHub Desktop.
Toggle bluetooth via AppleScript, which I use with Keyboard Maestro to toggle bluetooth via a hotkey combo
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
-- This assumes you have both growlnotify and blueutil installed. | |
-- You can set the path to either/both apps in the script on line 12 and 13 | |
-- blueutil is a command line utility to turn bluetooth on and off and is available here: | |
-- http://www.frederikseiffert.de/blueutil/ | |
-- growlnotify is a command line utility to post Growl notifications and is available when | |
-- installing Growl 1.2.2 which is available here: | |
-- http://growl.googlecode.com/files/Growl-1.2.2.dmg | |
set blueutilpath to "usr/local/bin/blueutil" | |
set growlnotifypath to "usr/local/bin/growlnotify" | |
set sb to last word of (do shell script blueutilpath & " status") | |
if sb is "on" then | |
do shell script blueutilpath & " off" | |
set sb_status to "off" | |
else | |
do shell script blueutilpath & " on" | |
set sb_status to "on" | |
end if | |
do shell script growlnotifypath & " Bluetooth Status: " & sb_status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment