As someone who prefers using the keyboard over the mouse, the Finder’s color labels annoy me to no end—there’s simply no way to use the keyboard to assign them. You can open the Get Info window by pressing Command-I, but neither the arrow keys nor Tab key will select the label section of the Get Info window. The same holds true for the Finder’s contextual menu—you can use Tab to move through it, but the highlight will skip right over the label section.
But using a bit of AppleScript and Butler, my favorite do-it-all utility, it’s possible to implement your own keyboard-friendly method of applying color labels in the Finder. With some modifications, this hint should work with other utilities such as Quicksilver, LaunchBar, and any other program that can assign keyboard shortcuts to AppleScripts.
The basics of the hint are fairly straightforward: in Butler, we’ll create a new AppleScript item, and insert some code to assign a color to the selected file (or files) in the Finder.
I’ll walk through that process in detail, then I’ll offer up an easy way to add a full set of color label scripts to Butler’s configuration. If you’re only interested in the ready-to-use Butler add-in, skip to the end of this hint; the following is for those interested in how this works.
To create a keyboard shortcut to set any given color label, open Butler’s configuration screen (click Butler’s menu bar icon, then select Butler -> Customize). Select the Hidden section of the configuration screen, then click the plus sign at the lower left corner of the screen.
On the pop-up menu that appears, select Smart Item -> AppleScript -> AppleScript. This will create a blank AppleScript item in Butler. In the right-hand column of the AppleScript configuration, type a name for your script—Set to Red or something like that. Click on the Source Code tab, and paste in this AppleScript:
property file_color : 2-- replace '2' above with the number for the color you'd like to use:-- 0=none, 1=orange, 2=red, 3=yellow, 4=blue, 5=purple, 6=green, 7=grey tell application "Finder" activate set selected to selection repeat with n_file in every item in selected set label index of n_file to file_color end repeatend tell
Next, click on the Triggers tab, and set up the Hot Key you’d like to use—Command-Control-R for red, perhaps. When you enter a Hot Key, the Exceptions box will become visible; set its pop-up menu to Only, and then type Finder in the box below the menu. This tells Butler to only watch for this hot key when you’re in the Finder—which is the only place you’ll be applying Finder color labels, obviously.
You can repeat this process for each of the other colors, creating a new script and shortcut for each—if you were going to do this, you might want to assign number-based shortcuts, instead of letters. Use Command-Option-1 through -7, for instance, to set each color, and maybe Command-Option-X to remove an existing label.
Instead of walking you through the detailed and repetitive process of creating the scripts and container, though, just download this 4KB Butler container, which is ready to use. Expand the archive, then just double-click the resulting Finder Labels.butleritems to add it to Butler. (You may then need to drag it into the Hidden section of Butler’s configuration window, depending on which section is active when you double-click the file.) The shortcut keys are defined as described above, though they can be easily changed.
I love this solution—when I need to assign color labels in the Finder now, I either do it directly via Command-Option and 1 through 7, or by using the pop-up menu (Command-Option-L) and the arrow keys. Both methods are notably quicker than reaching for my mouse and navigating the Get Info window or contextual menu.
As noted earlier, with some modifications, you should be able to create a similarly-effective solution using these scripts in any program that’s capable of running AppleScripts via a hot key (though Butler’s ability to create a pop-up menu may not be as easy to replicate). If you have any questions, please ask, and I’ll do my best to answer them.