Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- this script will turn bluetooth on if you're connected to mains power when it runs
- and turn bluetooth off if you're running on battery power
- Applehelpwriter 2013
- *)
- tell application "System Preferences"
- activate
- set the current pane to pane id "com.apple.preferences.bluetooth"
- end tell
- set _power to do shell script "pmset -g | grep AC"
- set _power to last character of _power
- if _power = "*" then
- tell application "System Events"
- set _status to checkbox "On" of window "Bluetooth" of application process "System Preferences"
- tell _status
- if not (its value as boolean) then click _status
- end tell
- end tell
- else
- tell application "System Events"
- set _status to checkbox "On" of window "Bluetooth" of application process "System Preferences"
- tell _status
- if (its value as boolean) then click _status
- end tell
- end tell
- end if
- tell application "System Preferences" to quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement