How can I reset network (Airport) connections from the command line?
How can I set up a keyboard shortcut to toggle the Airport (on/off) on OS X?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Based on a similar question How can I reset network (Airport) connections from the command line?
Create two applescript files:
do shell script "/usr/sbin/networksetup -setairportpower en1 on" do shell script "/usr/sbin/networksetup -setairportpower en1 off"
Then use fastscripts to assign keyboard shortcuts to them.
I found this:
Toggle AirPort on and off using keyboard shortcuts
Oct 17, '08 07:30:03AM • Contributed by: Anonymous
This is the simplest way I've found to toggle the AirPort card on and off without using third party applications or too many buttons. Hopefully others will appreciate this function as I do. Note: This function is tailored to a MacBook, as the F5 and F6 keys have no predetermined function on these machines. Other machines may need the shortcut keys to be edited.
1- Create two keyboard shortcuts. Go to the Apple menu » System Preferences » Keyboard & Mouse » Keyboard Shortcuts tab. Click the plus sign at the bottom of the window, and select All Applications from the pop-up menu in the next dialog. In the Menu Title box, type Turn AirPort On with that exact case and spelling. Set the Keyboard Shortcut to F5, then click Add. Click the plus sign again, leave the pop-up menu set to All Applications, and in the Menu Title box, type Turn AirPort Off with the shortcut key also set to F5 -- only one of these functions will be displayed at a time.
2 - In the Keyboard Navigation section of the same window, change the 'Move focus to status menus in the menu bar' to F6 (and check the box to enable this shortcut, if it's not yet enabled).
3 - Make sure the AirPort icon is in your menu bar. Then hold down the Command key and drag the AirPort Menu bar icon as far to the left as possible. This insures that it is the first to be selected when you move focus to the menu bar.
4 - Finally, restart your system. After your Mac reboots, press F6 to move focus to the menu bar, and F5 to toggle AirPort on or off, depending on its current state.
Aside from the problem with dragging to the left-most position (as other Mac "shortcuts" require that same position), this should work fine.