[X4U] Labelling Folders

Bill White billwhite at mac.com
Tue Mar 29 10:18:40 PST 2005


On 3/29/05 11:51 AM, Mark Des Cotes <mark at astroprinting.com> wrote:

> Is there some way, using Terminal perhaps or maybe an Apple Script, where we
> can tell the computer to label all new folders with the User's colour?

> I'd like to set it up so that one computer creates green folders by default,
> another creates orange folders by default, and so on.

I don't how to initiate that behavior by default, but AppleScript will let
you set a folder's color (or "label index", a number from 1 to 7).

tell application "Finder"
    
    set newFolder to make new folder
    
    set label index of newFolder to 6 -- "green"
    
end tell

Of course if a user forgets to color a folder manually they would probably
also forget to run this script to create a new folder! You could either put
such a script in the Script Menu and have them choose it each time, or use
something like QuicKeys or Keyboard Maestro to assign a keyboard shortcut to
the script, even using Command-Shift-N as the trigger if they're used to
creating a folder like that.

-- Bill

PS. For some odd reason, the "label index" property doesn't reflect the
order of the colors shown in the File > Color Label: menu! To easily see
what colors are what, run the following:

tell application "Finder"
    
    repeat with i from 1 to 7
        
        set newFolder to make new folder
        
        set label index of newFolder to i
        
        set name of newFolder to i as string
        
    end repeat
    
end tell




More information about the X4U mailing list