Need Some Help? Have a Tip to Share?

Email me at MacTipper@gmail.com, or, leave a comment!

Subscribe To Our FREE RSS Feed!

Don't miss out on any posts from the Concise MacTipper Blog.

Wednesday, March 18, 2009

Turn On and Off Your Airport With a Keyboard Shortcut

I have found a way to script turning on and off the airport. If you just want a script to do this, you can download one here. This script should work with Tiger and Leopard. However, I have only tested it on Leopard.

Tiger users: the following section does not work in Tiger because the networksetup CLU is in a different place than in Leopard. You will need to replace every instance of "/usr/sbin/networksetup" with "/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup"

Now for the guts of the script. To find out how to use the networksetup command line utility, use:

/usr/sbin/networksetup -printcommands


Note that to use the networksetup CLU you need to use "/usr/sbin/networksetup" and not just "networksetup".

The terminal command to turn off the airport is:

/usr/sbin/networksetup -setairportpower off


to turn it back on, change "off" to "on":

/usr/sbin/networksetup -setairportpower on


[Via]

0 comments:

Post a Comment