?

Log in

No account? Create an account
entries friends calendar About MEEE! Previous Previous Next Next
June 26th, 2007 - Schadenfreude is my life — LiveJournal
...because Misanthropy is FUN
bynkii
For those of you wanting a (close to) one step way to toggle airport and bluetooth on and off ala "Airplane mode" on a cell phone:

property bluetoothDaemonPath : "/usr/sbin/blued"
property bounceBlueD : "/usr/bin/killall -SIGHUP blued"
property bluetoothOn : "/usr/bin/defaults write com.apple.Bluetooth \"ControllerPowerState\" 1"
property bluetoothOff : "/usr/bin/defaults write com.apple.Bluetooth \"ControllerPowerState\" 0"
property airportOn : "/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup -setairportpower on"
property airportOff : "/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup -setairportpower off"

try
set theAirplaneModeRecord to display dialog "Click the appropriate button to enable or disable Airplane Mode on your Mac" buttons {"Cancel", "Airplane Mode On", "Airplane Mode Off"} default button "Cancel" with icon caution giving up after 60
set theAirplaneModeButton to button returned of theAirplaneModeRecord

if theAirplaneModeButton is "Cancel" or "" then
quit
else if theAirplaneModeButton is "Airplane Mode On" then
do shell script airportOff with administrator privileges
do shell script bluetoothOff
do shell script bounceBlueD with administrator privileges
else if theAirplaneModeButton is "Airplane Mode Off" then
do shell script airportOn with administrator privileges
do shell script bluetoothOn
do shell script bounceBlueD with administrator privileges
else
quit
end if
end try
Leave a comment