This answers the more specific question in your comment to your original question. It could probably have been a new question since it is much more specific.
To set the “Color Label” of the currently selected files, you can combine an AppleScript program (or a shell program that uses osascript) with any of the multitude of “launcher” applications (Quicksilver, FastScripts, etc.) that can run AppleScript programs (or shell programs) based on a shortcut key combination.
For any of the scripts below, paste them into Script Editor / AppleScript Editor and save them in “script” format (or whatever format your chosen launcher uses). The usual place for such saved scripts would be ~/Library/Scripts/Applications/Finder, but, depending on your launcher, you could use other locations.
Here is a simple version that you can hard-code to any one of the labels:
on run
tell application "Finder"
repeat with anItem in (get selection)
(*
* 0 - none
* 1 - Orange
* 2 - Red
* 3 - Yellow
* 4 - Blue
* 5 - Purple
* 6 - Green
* 7 - Gray
*)
set label index of anItem to 4
end repeat
end tell
end run
If you only have a couple of labels that you use, you might save a couple of copies of this and bind a key to each copy.
Here is a version that always prompts you for which label to apply:
on run
tell application "Finder" to set selectedItems to selection
if length of selectedItems is 0 then
display dialog "Select some items in Finder before running this program." with title "Apply Finder Label to Selected Items" buttons {"OK"} default button {"OK"}
return
end if
set labels to prependIndicies(getLabelNames())
set default to first item of labels
set labelIndex to choose from list labels default items default with prompt "Choose label to apply to selected items" without empty selection allowed and multiple selections allowed
if labelIndex is false then return
set labelIndex to (first word of first item of labelIndex) as number
tell application "Finder"
repeat with anItem in selectedItems
set label index of anItem to labelIndex
end repeat
end tell
end run
to getLabelNames()
set labelNames to {"Orange", "Red", "Yellow", "Blue", "Purple", "Green", "Gray"}
set useCustomLabelNames to true -- change to false if this is too slow or does not work for you
if useCustomLabelNames then
set cmds to {}
repeat with i from 1 to 7
set end of cmds to "defaults read com.apple.Labels Label_Name_" & (8 - i) & " || echo " & quoted form of item i of labelNames
end repeat
set text item delimiters to {";"}
set labelNames to paragraphs of (do shell script (cmds as text))
end if
end getLabelNames
to prependIndicies(theList)
repeat with i from 1 to length of theList
set item i of theList to (i as text) & " - " & (item i of theList)
end repeat
{"0 - none"} & theList
end prependIndicies
When the dialog appears, type one of 0-7 to select a label, then hit Return to apply it to the items selected in Finder.