Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use a keyboard shortcut to change Locations Network
I change locations (use the Apple Menu -> Location menu item) at minimum twice every workday. I wanted to add shortcuts to make it easier/faster, but after adding the name of my location in the Keyboard & Mouse Preferences panel, it still didn't work. The shortcut shows in the menu item, but it only works after you have hovered over the "Location" submenu, and let it display the menu (and you have to do this every time an app is launched).

So I thought, why not have a keystroke do the job via Butler (or another similar utility)?

Note: Control-F2 (by default) selects the Apple Menu and it will prevent you from creating a keystroke with that definition. Before you proceed, you have to disable the 'Move focus to the menu bar' feature in the Keyboard & Mouse System Preferences panel. Look on the Keyboard Shortcuts tab, in the Keyboard Navigation section. Just uncheck the box next to this feature.

The three locations I use the most are in this order (at the top of the sub-menu):
  • •Home
  • •Work | DTS Office
  • •Work | Other
Those bullets are in the names because it keeps the entries at the top of the sub-menu. Since they are in order, I will use the down arrow key in my keystroke to select the location. Alternatively, you could use the first character or more of the name to select it.

So I went to my Butler config and created a new keystroke:
Control-F2, Down Arrow, L, Right Arrow, Return
This changes the location to •Home. To switch to •Work | DTS Office, I did:
Control-F2, Down Arrow, L, Right Arrow, Down Arrow, Return
The keyboard shortcut/keystroke you assign it is also important. You want to avoid using Command, as it will hang up the process and prevent it from executing if you hold down the Command key too long (it hangs right after Control-F2). So to avoid that hassle, I assigned Control-Option-F1, Control-Option-F2, and Control-Option-F3 to my three most-used locations.

When you are all done, don't forget to re-enable 'Move focus to the menu bar' to make it all work. And instead of having to turn it off again in the future to create additional keystrokes, just duplicate one of the existing keystrokes you've already defined and modify the duplicate (Butler lets me do this).

I hope this saves many laptop users some unwanted trips to the Apple Menu, at least via the mouse.
    •    
  • Currently 2.00 / 5
  You rated: 2 / 5 (6 votes cast)
 
[17,444 views]  

Use a keyboard shortcut to change Locations | 8 comments | Create New Account
Click here to return to the 'Use a keyboard shortcut to change Locations' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
QuickSilver good too.
Authored by: Diggory on Jan 16, '06 08:31:24AM

There is a Network Locations plug-in for QuickSilver that does a good job too.

Either set them up with 'triggers' - or I just pop up the QS window and start typing the name of the location.

---
*****
monkeyfood software - http://www.monkeyfood.com



[ Reply to This | # ]
Even Better
Authored by: fredo71 on Jan 17, '06 12:14:48AM

Location X
http://homepage.mac.com/locationmanager/

Full location manager that allows you set more than just the network prefs. BUt more impressively, it an Autolocate feature for wireless. Define the SSID and profile you want used and when you enter that wireless network, it autmatically switches you to ther preferred profile!



[ Reply to This | # ]
Use a keyboard shortcut to change Locations
Authored by: caesurae on Jan 16, '06 10:55:08AM
i've created some tcsh aliases that select each of my network locations using the scselect command.

alias netloc_0 '/usr/sbin/scselect "Off"'
alias netloc_1 '/usr/sbin/scselect "Linksys WRT54G"'
alias netloc_2 '/usr/sbin/scselect "Motorola SB3100"'
alias netloc_3 '/usr/sbin/scselect "Motorola VT1000v"'

it would be trivial to store each command in an AppleScript, or a shell script and execute them via Apple's Script Menu or QuickSilver, Butler, etc ( i find the latter options to be unnecessary ;P ).

one could also assign them as keybindings. the following example assigns each of my locations to function keys F1, F2, F3, & F4.

bindkey -c "^[[11~" '/usr/sbin/scselect "Off"'
bindkey -c "^[[12~" '/usr/sbin/scselect "Linksys WRT54G"'
bindkey -c "^[[13~" '/usr/sbin/scselect "Motorola SB3100"'
bindkey -c "^[[14~" '/usr/sbin/scselect "Motorola VT1000v"'

fyi, i use OS X 10.3.9 (Panther), Apple X11, rxvt, & tcsh.



[ Reply to This | # ]

[OT] - other Ctrl-FKey shortcuts
Authored by: jspivack on Jan 16, '06 01:35:11PM

this hint led me to explore...
Ctrl-F1: toggles CTRL-FKey functionality
Ctrl-F2: Apple Menu (mentioned in the hint)
Ctrl-F3: pops up the Dock and selects an app (I can't determine how it chooses)
Ctrl-F4: app switches (like alt-tab, but without the bezel)
Ctrl-F5: app-centric (interacts with frontmost app, but doesn't seem to do much)
Ctrl-F6: app-centric (selects first column header in Eudora)
Ctrl-F7: nada?
Ctrl-F8: pops down Modem menulet
Ctrl-F9-12: nada? (I have them set to Expos and Dashboard - that migth influence their behavior)

Fun stuff - offtopic, but I thought it should be documented somewhere on this site...



[ Reply to This | # ]
[OT] - other Ctrl-FKey shortcuts
Authored by: twalkabout on Jan 16, '06 03:58:18PM

hey jspivack,

those control-fn key shortcuts are actually listed in the 'keyboard shortcuts' tab of the 'keyboard and mouse' preference pane. here is how they are documented:

**Keyboard Navigation**

^F1 Turn full keyboard access on or off
^F2 Move focus to the menu bar
^F3 Move focus to the dock
^F4 Move focus to the active window or next window
^F5 Move focus to the window toolbar
^F6 Move focus to the floating window
^F7 Move between controls or text boxes and lists
^F8 Move focus to status menus in the menu bar

apple-option-` Move focus to the window drawer
apple-option-T Show or hide the Character Palette
apple-` Move focus to the next window in active application
note that "`" is the tilda '~' key.
**

some of them are also listed at http://docs.info.apple.com/article.html?artnum=75459

I would be interested in hearing from someone that uses these regularly.



[ Reply to This | # ]
Use a keyboard shortcut to change Locations
Authored by: bdog on Jan 16, '06 03:08:36PM
Thanks to Jerome (eMailed me) and caesurae for pointing out the scselect command. I never even knew about that one! So now I use it, instead of a keystroke. I first had to remove the bullets in the location names because scselect couldn't find them (I used a space instead to keep the menu organized). Now Butler runs a little AppleScript like, for example:
do shell script "scselect ' Home'"


[ Reply to This | # ]
Use a keyboard shortcut to change Locations
Authored by: petersconsult on Jan 17, '06 03:04:09AM

Hello All,

I have been trying, in vain, to come up with some way to automate changing the default SMTP server for all my active email accounts (in Mail) at the same time as I change Locations.
Or at least, creating a script that just changes the default SMTP servers in all active email accounts.

Has anyone done this?
It seems that in this day and age when more and more ISPs impose their own wretched SMTP servers, and block outside communications on port 25, someone would have thought of this.

I'm sure this would help more people than just me...

Cheers,
Peter



[ Reply to This | # ]
Easier switch and a Growl notification
Authored by: gabrielradic on Jan 17, '06 03:05:50AM
I use this AppleScript to switch the location and send a Growl notification:

set theLocation to "Automatic"
-- use this variable so to easily duplicate the script for other locations

tell application "Finder"
	do shell script "scselect " & theLocation
end tell

-- this is about it for the location switch
-- the rest is for the Growl notification

tell application "GrowlHelperApp"
	set the allNotificationsList to 
		{"Switch Network Location"}
	set the enabledNotificationsList to allNotificationsList
	register as application 
		"Butler" all notifications allNotificationsList 
		default notifications enabledNotificationsList 
		icon of application "Butler.app"
	
	notify with name 
		"Switch Network Location" title 
		"Network Location" description 
		"Switched to " & theLocation application name "Butler"
	
end tell
Then you can create a custom item in either Butler (highly recommended over QS) or another launcher. You may need to adjust the script for other launchers.

[ Reply to This | # ]