Setting Color Labels in a Folder

Hey guys! I'm kinda new to AppleScript in general, so please bear with me if this is just a simple request here, but basically i've been wanting to change the background of the finder windows to match the grey background of the iTunes grid view. However, since the font colour of the files and folders in Finder can't be changed, but the only way is to place a border around them (grey seems to match best). Now i've found a script that manages to do this for all the files in the folder and its subfolder based on the filetypes outlined in the script. However, none of the folders themselves have changed to the desired grey colour.Its clearly because the file type for the folder hasn't been added, but im not sure how i do that. As you can see I tried adding "Folders" to the "set fileColorList to greys" line, but its a no go... Is there any way i can just change that whole section of code to just have all the files and folders within the subfolder to go grey? (i.e. greys{"*"} or something) rather than having to individually add the filetypes?.
Here's the code:
tell application "Finder"
set processFolder to (choose folder with prompt "Select a folder to change label colors") as item
my digDeeper(processFolder)
end tell
on digDeeper(myFolder)
tell application "Finder"
my changeColors(myFolder)
set subFolders to every folder in folder myFolder
if (count of items in subFolders) is greater than 0 then
repeat with thisFolder from 1 to count of items in subFolders
set processSubFolder to item thisFolder of subFolders as string
my digDeeper(processSubFolder)
end repeat
end if
end tell
end digDeeper
on changeColors(myFolder)
set fileColorList to {greys:{"Folders", "mpg", "pages", "keynote", "numbers", "mpeg", "bmp", "wma", "c", "cpp", "dmg", "doc", "asf", "jpg", "jpeg", "ram", "h", "hpp", "mpkg", "iso", "bin", "ppt", "pps", "bundle", "mov", "qt", "gif", "aif", "aiff", "htm", "html", "hqx", "tar", "xls", "mp4", "rgb", "rgba", "pcm", "js", "css", "cgi", "pkg", "gz", "z", "tgz", "localized", "pdf", "avi", "tif", "tiff", "mp3", "m", "zip", "eps", "ai", "wmv", "mkv", "m2ts", "mov", "ts", "rar", "png", "wav", "scpt", "tbz", "bz2", "dat", "txt", "prefs", "rm", "ram", "rcproject", "ra", "psd", "pl", "xml", "plist", "sit", "rar", "torrent", "rtf", "rtfd"}}
tell application "Finder"
try
set (label index of every file of item myFolder whose name extension is in greys of fileColorList) to 7
end try
end tell
end changeColors
Thanks for any help!

Your folder action script doesn't work because of one simple error:
set label index of every item of entire contents of processFolder to 7
Nowhere in your script is 'processFolder' defined, so AppleScript has no idea what you're trying to do.
Given that you (correctly) iterate through added_items, the correct format would be:
on adding folder items to this_folder after receiving added_items
  repeat with item_ in added_items
    tell application "Finder"
      set label index of item_ to 7
    end tell
  end repeat
end adding folder items to
In other words, this changes the label index of each item just added.
That should work provided you're dropping files into this folder. If you're dropping folders then this would set the label index of the folder itself, but not necessarily the items within that folder. For that you'd need to add a check to see if item_ was a folder and add code to handle folders.
Also note that this kind of folder action will only work on the folder itself - that is, if you have folder A that contains subfolder B, then dropping a file into subfolder B won't trigger the script and won't change that item's label. To do that you'd have to attach your folder action to subfolder B.

Similar Messages

  • Folder action to change the label of the folder

    Hi all
    I would like to use Automator/Folder Actions to set the Label of the folder to show that it contains a file that was created or modified as follows:
    Red if in the last three days,
    Orange if over three days but less than seven; and
    Yellow if over seven days but less than fourteen
    Oh, and clear the folder label if the contents of the folder are over fourteen days old.
    Is it possible to do using Automator and folder actions?
    Thanks
    Jai
    iMac G5; iBook G3; PB165c; PB170; Mac IIcx; Mac SE/30; Mac SE; Mac Plus; Newton 130; 2gen iPod 10G     Mac OS X (10.4.7)   MacUser since 1984... and waiting for a tablet (like the Nokia 770 with MacOSX)

    In Automator-No
    The trigger for folder actions to run is the act of adding a file/folder to the folder which has the action applied. If you don't add anything, they won't do anything.
    You could probably get close to what you want using Smart Folders. It won't be color-coded or perfect though because modifying a file doesn't always reflect on the modification date of the folder. And parent folders are not affected by changes made in sub-folders.

  • Lightroom CC isn't including color labels when images are imported

    I've tried this several times, but it doesn't work. Lightroom CC will import metadata and even star ratings, but it won't import the color label data assigned to the images from within Bridge. How can I get that information to be imported?
    In other words, working in Bridge CC I assigned star ratings and color labels to a folder full of JPG files. When I import those files into Lightroom CC, the images, metadata and the star ratings are imported, but no color label data was imported. None of the images have color labels when viewed in LR. They still retain the color labels when I view the files in Bridge CC, but they don't appear in LR.

    I just struggled with this for an hour. Any changes made to labels inside Lightroom 5 didn't show up in Bridge CC after reading metadata from file, and imports into LR5 did not properly show Bridge CC's label colors. Instead, only a tiny white rectangle at the bottom right of each labeled thumbnail showed in LR5.
    Finally figured it out. In the Lightroom 5 file menu up top, go to:
    Metadata --> Color Label Set --> Bridge Default (select this option)
    'Lightroom Default' was previously selected in mine, as I suspect all Lightroom 5 installs are initially.
    Make sure that the names beside each color are identical in both Bridge & LR, or you will still have syncing problems.
    This should fix your problem!

  • Apparent bug in 3.1's handling of color labels

    This ties is with [Applescipt manipulating color label|http://discussions.apple.com/thread.jspa?threadID=2645193&tstart=15] posted earlier today.
    If you set the color label of an image to have no color label via the pulldown in the metadata tab of the inspector (select the first circle which will display the text *No Label* when selected) the images color label is set to the string "No Label". Confirm this by looking at the browser in column view, the third column in the default view is Label. You'll see that for colors you'll get a circle of the color and the string name of the color. You'll also notice that other images that do not have a color label simply have --
    The problem arises if you select *No Label* in the search field or Filter HUD. The images labeled as *No Label* rather then the empty string will not show up in the search.
    The *No Label* string can be cleared out by setting the images label to No Label via the +Command 0+ keystroke.
    The Applescript command to set color labels also exhibits this behavior.

    Working with events can sometimes be interesting.  I concentrated my efforts more on fixing the issue than trying to determine if this is a bug or not.  I modified your code slightly to filter events based on click type and I think it is working the way you intended.  Let me know it is not quite right.
    Attachments:
    Double-click-click[2].vi ‏62 KB

  • Color labels: I never see 'em; not color blind too

    I set color labels for clips, and there is no indication whatsoever on the clip thumbs or in the source panel or anywhere.
    I see nothing you could call a label or color label.  Presumable the labels are for easy locating? 

    Thanks you.
    While we are at it, what is the philosophy here please?
    I would put as much on "SCRATCH" as possible, but
    never anything I would want later.  "Captured video"
    has me puzzled cuz the video is "captured" to a location
    long before Premiere gets involved and I dont want to
    change said location.  "Previews" seems ok obvious.
    I'll keep my auto saves where I can find them till it's
    time to dump them.

  • Color labels label nothing

    I set color labels on clips in the bin view, but there are no colors showing whatosever.
    This is "carribean". So how do I mark something to know what I have marked?
    Also, why is the audio link missing here?  The audio is NOT missing.  OK the link
    reappears when I LEAVE the source box.
    Thanks anyone !

    shooternz wrote:
    I was trying to work out how to ask in an abbreviated way..
    "who owns that stratocaster" ....ie "to whom does that stratocaster belong"

  • Applescipt manipulating color label

    In manipulating image version's color label,
    set color label to no color label,
    It results in browser's label column,"no label" not a nomally "--"
    Is there way to set label to "--" ?
    -- some operations to determine color label here reseult to vResult
    -- inside tell image versions
    if vResult is equal to "" then
    set color label to purple
    else
    set color label to no color label
    end if

    Looks like the color label is just a string that Aperture interprets to actually turn on the color. So for example an image marked Orange has an orange dot and the string "Orange" next to it.
    So as a long shot you can try try setting the color label in the script to Null (or the applescript equivalent) or even just "".
    On the images you've set the color label to "No Label" with the script, do they still show up in searches for images with no label? If they do then does it really matter what they look like in column view?
    regards

  • Close all folders in Mail?  Color Label folders?  Find folder?  And More!

    Hi all.
    I have a LOT of mail. They're all very organized, though. Heaps of Mailboxes (Folders) and Sub-folders.
    I also have heaps of rules dutifully sending incoming mail to their appropriate mailboxes.
    However...
    It has reached a point where one of of the major bottlenecks in my daily workflow is sorting through all these mailboxes.
    There are 5 primary mailboxes with perhaps 100-ish subfolders or sub-subfolders. Maybe more.
    When they are all open, or a lot of them are open, it is difficult to find the a specific folder when I need it. It would help if I could close all open folder with a shortcut.
    Is this possible?
    It would also help if I could visually distinguish each level. Can I color label the mailboxes(not the messages themselves)?
    Another help would be if I could run a search for a folder Mailbox name. Is this possible?
    Lastly when I create a rule I would love it if there was an option to 'Create new Mailbox' in the rule dialog box rather than having to create the mailbox first. Am I just missing this? See link for illustration:
    http://img.skitch.com/20080820-eaqmy89emw6xm5pcj86iuqu992.jpg

    I just had a look and you need to create the mailbox PRIOR to asking the rules to move it into that.
    Now, automator lets you create a new workflow, but not sure as to how to set that one up (might be possible; however, my mathematical brain tells what you want to achieve is flawed:
    1) IF new mail equals "tangerine", create new mailbox tangerine, then move message to mailbox "tangerine. (FINE so far!)
    2) the second "tangerine" message arrives, and the workflow should FAIL (because it cannot create a "new" mailbox "tangerine", as there is ALREADY a mailbox named "tangerine")
    3) if automator cannot execute "If" and "and" and the "sort by" all together, then distinguish (a "tangerine" message might actually need to go to "pear" but refers to "pears and tangerines", so it ends up in the wrong mailbox), you may have to start and restart mail, until all stages of the script have been executed.
    You see the problems?
    Anyhow, here is a link to some automator info:
    http://automatorworld.com/archives/automator-for-os-x-105-leopard-revealed/
    Good luck

  • Setting colors for item labels in JFreeChart (WaferMapRenderer)

    Hi,
    first of all, sorry for posting a JFreeChart related posting on this forum, but I didn't get a solution right now (I even didn't find anything useful on the JFreeChart website/forum). Here's my question...
    I'm trying to set the color for item labels in the legend but with no success.
    Here's a code example:
    final JFreeChart chart = ChartFactory.createWaferMapChart(
        "Wafer Map Demo",         // title
        dataset,                  // wafermapdataset
        PlotOrientation.VERTICAL, // vertical = notchdown
        true,                     // legend          
        true,                    // tooltips
        false
    WaferMapPlot plot = (WaferMapPlot) chart.getPlot();
    WaferMapRenderer renderer = new WaferMapRenderer();
    renderer.setSeriesItemLabelPaint(0, Color.red);
    renderer.setSeriesItemLabelPaint(1, Color.blue);
    plot.setRenderer(renderer);The default behavior of the WaferMapRenderer is also strange because the item label as well as the item marker is painted black so you cannot distinguish different fields of the wafer map. Is this a bug or am I doing something wrong (or missing somehting)?
    Any help would be greatly appreciated.
    Thanks and best regards,
    - Stephan

    Your folder action script doesn't work because of one simple error:
    set label index of every item of entire contents of processFolder to 7
    Nowhere in your script is 'processFolder' defined, so AppleScript has no idea what you're trying to do.
    Given that you (correctly) iterate through added_items, the correct format would be:
    on adding folder items to this_folder after receiving added_items
      repeat with item_ in added_items
        tell application "Finder"
          set label index of item_ to 7
        end tell
      end repeat
    end adding folder items to
    In other words, this changes the label index of each item just added.
    That should work provided you're dropping files into this folder. If you're dropping folders then this would set the label index of the folder itself, but not necessarily the items within that folder. For that you'd need to add a check to see if item_ was a folder and add code to handle folders.
    Also note that this kind of folder action will only work on the folder itself - that is, if you have folder A that contains subfolder B, then dropping a file into subfolder B won't trigger the script and won't change that item's label. To do that you'd have to attach your folder action to subfolder B.

  • Applescript to read text file & set color of matching files in a folder

    I am keen to find a way to process a file I have been given for a string and to check if that string exists as part of a filename in a folder on my disk.
    If the string in the file list corresponds to the file name in the folder then I want to color the corresponding file red.
    Can anyone suggest a way to do this?

    'I am keen to find a way to process a file I have been given for a string; - ? Is this to translate to - you have a file, containing multiple file names? And if so, are each file names on a separate line?
    My above questions are derived from the statement portion of - 'If the string in the file list corresponds to the file name ...'.
    Assuming such, here is some starter code:
    property tFolder : (((path to desktop folder from user domain) as string) & "untitled folder 2:") -- Provided folder path.
    on run -- Notify user to drag a file onto the applet.
    display dialog "Drag file onto applet, for further processing." default button "OK"
    end run
    on open dItems -- Obtain a list of dragged-on items.
    repeat with i in dItems -- Cycle through individual items
    set fList to paragraphs of (read i)
    repeat with j in fList
    with timeout of 0 seconds -- Extend default timetout to infinity.
    tell application "Finder" -- Activate 'Finder' for processing of desired folders' contents.
    try -- Capture any unwanted AppleScript errors.
    -- Obtain a list of all files with the name stored in 'fName'.
    set tFiles to (every file of entire contents of folder tFolder whose displayed name contains j)
    -- or, use the line of code below (in place of the line of code above), if the complete file name, including file extension, is within the dragged file.
    -- set tFiles to (every file of entire contents of folder tFolder whose displayed name is fName)
    if ((count tFiles) > 0) then -- If one or file exists, proess the file(s).
    repeat with k in tFiles -- Cycle through the list of located files.
    set (label index of k) to 2 -- Set the 'label index' of located file to 'red'.
    end repeat
    end if
    end try
    end tell
    end timeout
    end repeat
    end repeat
    end open
    Save the above code as an application.

  • Automator: Apply Color Label and Copy to Folder

    I'm trying my hand at Automator, and I need help with one of my workflows (⇪). Basically, it's a service (accessible via right-click) that will apply a color label on an image file, and then copy that image file to a corresponding folder with the same color label. My current version works fine, except for the fact that I had to create seven versions to accommodate all seven colors.
    Is there any way to turn the color into a variable? I want the workflow to prompt me for a color, and then use that choice to run a search for the appropriate folder. I'd rather not hard code the color choice into separate services that all do the same thing.
    Also, the service currently assumes that it will run fast enough before I can deselect the target file. I'm sure it's possible that the folder search could lag out while I select another file, and the service will ultimately copy the newly selected item, rather than the initial target. Is there a way to ensure the service acts on whatever was selected when it was first triggered?
    I don't know AppleScript beyond copying-and-pasting other people's codes, so that limits my automation quite a bit. I don't know how to prompt for a label index choice and then feed the result into a find function. I also don't know how to record the file path of the selected item, and then feed that into the copy function at the end to ensure it doesn't copy the wrong file.

    Typically a list of items is passed to a workflow, so you will usually (depending on what you are doing with the items) need to step through the items in that list. If there is only one destination folder with the target label, you can just search for it, otherwise you will need to specify the destination in some other way.
    The following Service workflow example assumes that there is only one destination folder that has a given label color. It gets the label index of one of the input items and finds a folder with the same index at a specified base location (to limit the search range).
    1) Input items are automatically passed to an application or service, otherwise another action to get FInder Items can be used
    2) *Label Finder Items* (show the action when the workflow runs)
    3) *Run AppleScript* (paste the following script)
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- copy to a labelled folder
    This action is designed to follow a "Label Finder Items" action.  It will get the
    first folder of the base folder that has the same label and copy the input items
    to that folder.
    input: a list of Finder items received from a "Label Finder Items" action
    output: a list of Finder items to be passed on to a following action
    set output to {}
    set skippedItems to {} -- this will be a list of skipped items (errors)
    set baseFolder to (((path to pictures folder) as text) & "Shelley:Mary:") as alias -- a place to start looking for the destination folder
    tell application "Finder"
    set theLabel to label index of (the first item of the input) -- just pick one, they should all be the same
    get folders of (entire contents of baseFolder) whose label index is theLabel -- include subfolders
    -- get folders of  baseFolder whose label index is theLabel -- no subfolders
    if the result is not {} then
    set theDestination to the first item of the result
    else -- no folder
    error number -128 -- cancel
    end if
    end tell
    repeat with anItem in the input -- step through each item in the input
    try
    tell application "Finder" to duplicate anItem to theDestination
    set the end of the output to (the result as alias)
    on error number errorNumber -- name already exists, etc
    set errorNumber to "  (" & (errorNumber as text) & ")"
    -- any additional error handling code here
    set the end of skippedItems to (anItem as text) & errorNumber
    end try
    end repeat
    showSkippedAlert for skippedItems
    return the output -- pass the result(s) to the next action
    end run
    to showSkippedAlert for skippedItems
    show an alert dialog for any items skipped, with the option to cancel the rest of the workflow
    parameters - skippedItems [list]: the items skipped
    returns nothing
    if skippedItems is not {} then
    set {alertText, theCount} to {"Error with AppleScript action", count skippedItems}
    if theCount is greater than 1 then
    set theMessage to (theCount as text) & space & " items were skipped:"
    else
    set theMessage to "1 item was skipped:"
    end if
    set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {skippedItems, AppleScript's text item delimiters} to {skippedItems as text, tempTID}
    if button returned of (display alert alertText message (theMessage & return & skippedItems) alternate button "Cancel" default button "OK") is "Cancel" then error number -128
    end if
    return
    end showSkippedAlert
    </pre>

  • Smart Folder not recognizing color labels

    I'm trying to set up a smart folder for photos that have a particular color label. It's not working for some reason. It works with ratings, and with flags, but not color labels.
    It's not a speed issue (I've come back to them hours later - still empty).
    Any suggestions on how to correct this problem?

    You'll need to describe what you're doing a bit more. I have multiple smart folders that search for color labels and it works.
    Where are you setting the smart folder? Are you sure the scope of the smart folder is searching in the correct place? What if you search from the smart album attached to the browser?

  • How do I find images in LR 2.4 (imported from CS4 Bridge) that have color labels already assigned In CS4 Bridge? I have set both Bridge and LR color labels text to match (eg Green for green, etc).

    How do you find images in LR 2.4 that have been imported from CS4 Bridge and have been assigned a color label in Bridge?  I have set both LR 2.4 and my CS4 Bridge to match the text for each color to be the same (eg. Green for green, etc), and the filter search in LR 2.4 shows that a label has been assigned, but I am unable to identify and locate the specific images in LR 2.4 that have had a color label assigned from CS4 Bridge.  I have tried to search via attribute, metadata, text, etc...Is it necessary to re-assign color labels all over again, image by image, in LR 2.4, or is there a way to automatically have the color labels assigned in CS4 Bridge be assigned and searchable to the images after they have been imported into the LR 2.4 catalogue from the Bridge program?

    JohnM.
    I closed both programs and re-imported photos and re-tried the action of having LR  read the XMP metadata from the CS4 files, and it seems to work now just fine...don't know why now and not before, but thanks much. Is there a way to have LR do this automatically upon import of images from CS4?  I tried to do this with an import metadata preset, but no luck.  It seems as if I can only do this once the images have already been imported into LR, and then to have to have LR read the metadata from the CS4 Bridge files.  thanks gain.

  • Only one color label set per photo???

    I had thought I could make good use of color label sets to visually organize page-layout/photo-groupings from collections, like those three red ones will go to page 3 and those 2 blue ones on page 4.
    AND then I though I could just switch to a Printing label set to take my photos through a "fix then print" "ready to print" "printed" set of cues.
    BUT seems like if I switch to different label set, then all markings of previous set get hidden and if I relabel a photo that used to be yellow in the previous set red then it overwrites the other set as well?
    The idea of sets then doesn't make much sense then because it's so easy to overwrite information applied from a different set.
    any thoughts? looks like I can only use the colors for one thing and so it now seems a waste to dedicate it's use just to indicate that pics still need to be sent out for printing. Perhaps I'll have to setup keywords for that instead - but they aren't so visual.
    r

    Collections, Metadata like keywords, are for your long term Ids. Color Labels, Picks and Ratings are for shorter term operations, as I see it.
    Don
    Don Ricklin, MacBook 1.83Ghz Duo 2 Core running 10.4.10 & Win XP, Pentax *ist D
    http://donricklin.blogspot.com/

  • Can I Set Submix Label Color

    I would like to be able to set the label color as can be done with tracks, and clips.  At the moment, all the submix tracks are the default green.
    Is there a way to set the label color? 
    In the manual, there is only a mention that the submix tracks have a color label, but no mention on how to change it, and cntl-click does not review a pop-up menu, and using the "Multitrack > Track Color" menu, has no effect.
    To me, is seems if a track has a color label, I should be able to change it...
    Any help would be greatly appreciated.
    TIA

    its still not working.
    i have the following:
    panelColorCode.setForeground(Color.black);
    panelColorCode.setLayout(new Gridlayout(0, 2));
    panelColorCode.setBackground(Color.white);
    ....add(new Label("Colour code"));
    ....add(new Label.. these are both white backgrounds
    ....add(new Label... ditto
    panelColorCode.setBackground(Color.gray);
    ....add(new Label....
    this last line sets the whole panel to gray, but i just want the last label to be greyed out. is this possible, am i being dim?
    thanks again for help

Maybe you are looking for

  • How to create a process type/variant for this in Process Chain

    i I created a Selective Delete Variant (Delete_Facts) with some data selection upon which data to be deleted, to be used in Process chain. My requirment is I need to include that in the process chain in a such a way that that variant should be execut

  • Crash? Error Icon?

    My powerbook has recently been running slow, not shutting down properly, etc. Then today- it wouldn't boot up. It gets to the gray screen with the spinning wheel and wont go past it. So I turned it off and this time when booting it up it went to a bl

  • Problem with touch screen. Please help!!!

    Ok I bought an iPad about a month ago now. At first it worked perfectly, runs apps smoothly, etc. But then something happened to the touch screen, it just randomly like pressed itself, it went into apps on its own and zoom in and out while on safari

  • ESO application creates a large number of temporary file

    Hello, To summarize, when users run large queries, use attachments, of generate PDFs, etc, temporary files are created in /sourcing/tmp folder. Files older than 24 hours are cleared from this folder when logs roll over. Our /sourcing filesystem is no

  • TS1559 hi, is it software problem or is it a hrdware problem?

    hi, i'm having iPhone 4s 6.1.3 and my wifi is grayed is there any way to fix it , i all ready try to do all the steps in the article above with no success can you please help? thx Ofir