One of the things about OS X 10.5 that I really like is the increased focus on keyboard shortcuts. As we’ve discussed here before, when you assign a shortcut in the Keyboard Shortcuts tab of the Keyboard & Mouse System Preferences panel, it’s instantly active in the specified application (or in all applications, if you set it up that way); prior versions of OS X required you to quit and restart the application to see the new keyboard shortcut.
Another nice change is that you can assign shortcuts to menu items in more places—such as the print dialog and the Finder’s contextual menu, as well as in Mail’s drop-down menu to set the sending account. It turns out there’s one more useful area that now accepts keyboard shortcuts: the Services menu.
Services are available in most OS X applications (automatically in Cocoa applications, and with some coding work in Carbon applications), and let you do useful things to selections. In the Finder, for instance, you can select a file and then select Finder -> Services -> Mail -> Send File to open a new Mail message with the selected file attached. While useful, this example also demonstrates the problem with services—they’re buried quite a few menu levels down from the top. For something like Send File, which you may use quite often, wouldn’t it be great to be able to just press a keyboard shortcut to do the same thing?
In Leopard, you can do just that, and it’s quite simple. Open the Keyboard Shortcuts tab of the Keyboard & Mouse System Preferences panel, and click the plus sign at the lower left to add a new shortcut. For this particular example, set the Application pop-up to Finder (for other Services that can be used with a text selection, you’d want to set this to All Applications). In the Menu Title box, type Send File, with that exact capitalization. Finally, in the Keyboard Shortcut box, enter the shortcut you’d like to use—I used Control-Option-F (F for file, as I already have another shortcut that uses M for Mail), then click Add.
That’s all there is to it. Switch back to the Finder, select a file, and press Control-Option-F (or whatever shortcut you assigned). Mail will come to the foreground (or launch, if it’s not running) with a new message window open, and the selected file attached.
You can use this method for any Services entry you use regularly. For me, I’ve assigned shortcuts to Send File, Look Up in Dictionary (which I set to All Applications), and a few others specific to programs I use, such as Smultron and NetNewsWire. Just remember to pick unique shortcuts, especially for anything you set to All Applications, so as not to conflict with a program’s existing shortcuts. It helps to add Control, Option, and/or Shift to the Command key to create shortcuts that are unlikely to conflict.