« It's "kick the IT guy" season again | Main | Yet another nail in the "Bloggers are Real Journalists" coffin »
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
Technorati Tags: AppleScript, Airplane Mode
Comments
Warning for Notes users: The commenting system uses HTML.I know this will be scary for some of you, especially Notes fans. However, open standards, rah-rah.
If you want to use less-than or greater-than signs, or other similar characters that HTML reserves,
you'll simply have to learn to do it the HTML way. Luckily, HTML is kind of popular, no matter what
your re-educators have told you, and you can easily find help on the intertubes.
