Color label of folders in applescript

Hi, I have a script to create job folders, the folders within are split into 2 sections and I want to colour label the folders in the script.
One set is for artwork and contains the start 'AW' and one set is for creative and contains the start 'CR'. I'd like all the artwork folders to be green and all the creative to be yellow, can someone help me and amend the script below to achieve this?
Thanks in advance.
-- make a folder structure
set ThePath to path to desktop -- the location to make the folder structure
set textYear to text -2 through -1 of ((current date)'s year as text)
set jobNum to text returned of (display dialog "Please enter Job Number:" default answer {textYear & "xxx"})
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job Name")
set JobNumName to jobNum & "_" & JobName
MakeFolderStructure out of {JobNumName, {jobNum & "_" & "AW_Elements", {jobNum & "_" & "AW_Downloads", jobNum & "_" & "AW_Links", {"eps-tiff", "jpg", "psd", "ai"}, jobNum & "_" & "AW_PDF", {"Hires", "Lores"}, jobNum & "_" & "AW_Photography", jobNum & "_" & "AW_Presenters", jobNum & "_" & "AW_Resource", jobNum & "_" & "AW_Gone_to_Print"}, jobNum & "_" & "CR_Elements", {jobNum & "_" & "CR_Presenters", jobNum & "_" & "CR_Downloads", {jobNum & "_" & "Bought", jobNum & "_" & "Reference"}, jobNum & "_" & "CR_Photography", jobNum & "_" & "CR_Resource", jobNum & "_" & "CR_Scamps", jobNum & "_" & "CR_Copy", jobNum & "_" & "CR_Working", {jobNum & "_" & "illustrator", jobNum & "_" & "indesign", jobNum & "_" & "photoshop"}}}} at ThePath
to MakeFolderStructure out of SomeItem at SomeFolder
make the folder structure defined in SomeItem at SomeFolder
SomeList defines the structure:
nested list items create folders in the previous text item - {"A", {"B", {"C"}}} = /A/B/C
empty text items will create untitled folders
parameters - SomeItem [mixed]: the folder structure
SomeFolder [alias]: the destination folder
returns nothing
          set ParentFolder to SomeFolder
          if class of SomeItem is list then
                    repeat with AnItem in SomeItem
                              if class of AnItem is list then -- add subfolder(s)
  MakeFolderStructure out of AnItem at SomeFolder
                              else -- add a new child folder at the current parent
                                        tell application "Finder" to make new folder at ParentFolder with properties {name:AnItem}
                                        set SomeFolder to the result as alias
                              end if
                    end repeat
          else -- add a new (potential) parent folder
                    tell application "Finder" to make new folder at SomeFolder with properties {name:AnItem}
                    set ParentFolder to the result as alias
          end if
end MakeFolderStructure

you added the code incorrectly in the other thread.  Your handler should look like this:
to MakeFolderStructure out of SomeItem at SomeFolder
          set ParentFolder to SomeFolder
          if class of SomeItem is list then
                    repeat with AnItem in SomeItem
                              if class of AnItem is list then -- add subfolder(s)
                                        MakeFolderStructure out of AnItem at SomeFolder
                              else -- add a new child folder at the current parent
                                        tell application "Finder"
                                                  make new folder at ParentFolder with properties {name:AnItem}
                                                  set NewFolder to the result as alias
                                                  if name of NewFolder begins with "CR" then
                                                            set label index of NewFolder to 3
                                                  else if name of NewFolder begins with "AW" then
                                                            set label index of NewFolder to 6
                                                  end if
                                        end tell
                              end if
                    end repeat
          else -- add a new (potential) parent folder
                    tell application "Finder" to make new folder at SomeFolder with properties {name:AnItem}
                    set ParentFolder to the result as alias
          end if
end MakeFolderStructure
Note that I changed SomeFolder to NewFolder in the Finder block. SomeFolder is not used after that line, but it is used earlier, and using a new variable is less confusing.

Similar Messages

  • Why did Apple change the color labels of folders in 10.9.2?

    What's the purpose of a dot when I can't even see them?
    THE IDEA is to highlight a folder so you can easily find it.
    I'm all for aesthetics but this is a change of practical design. It's annoying.

    Also for the bug that iTunes doesn't minimize when I double-click the top edge of the window.
    It isn't a bug, it's a feature.
    Actually, I kinda like the improvements to the "miniplayer" thing, even though it isn't the same thing as minimizing the app. The only thing I don't like about the miniplayer is the tiny, hard to hit icon used to toggle it on & off, but if I can just remember the Cmd-Option-M shortcut for that I'm OK with that too.
    I wouldn't mind filling out a survey before they (Apple) curtained features.
    After hanging around ASC for a few years, I have realized that almost everybody has very different ideas about the usefulness of just about every feature Apple has ever implemented. If Apple listened to users, I suspect we would end up with an OS so bloated it wouldn't even be able to crawl, much less run, on most Macs, & the user preferences alone would have so many options nobody could find the ones they wanted without help.
    Actually, I think that may already be happening ... but I'm sure everybody has a different opinion about that, too!

  • Change folders color labels

    Hi, I want to change the color label of folders which contain specified files, eg movs, jpegs. I don´t want to copy or remove files, because folder size is about 140 GB. The biggest group of files is about 50 GB. I mention this, because I think getting specified finder items could be a problem for my little ibook?
    Thanks in advance

    Also for the bug that iTunes doesn't minimize when I double-click the top edge of the window.
    It isn't a bug, it's a feature.
    Actually, I kinda like the improvements to the "miniplayer" thing, even though it isn't the same thing as minimizing the app. The only thing I don't like about the miniplayer is the tiny, hard to hit icon used to toggle it on & off, but if I can just remember the Cmd-Option-M shortcut for that I'm OK with that too.
    I wouldn't mind filling out a survey before they (Apple) curtained features.
    After hanging around ASC for a few years, I have realized that almost everybody has very different ideas about the usefulness of just about every feature Apple has ever implemented. If Apple listened to users, I suspect we would end up with an OS so bloated it wouldn't even be able to crawl, much less run, on most Macs, & the user preferences alone would have so many options nobody could find the ones they wanted without help.
    Actually, I think that may already be happening ... but I'm sure everybody has a different opinion about that, too!

  • Color labels distorsion in column view?

    My color labels on folders look strangely distorted when in column view: there are two white halfmoons breaking the color at the beginning and end of the label. Has anyone experienced the same or know how to resolve it?

    The color highlighting corresponding to the applied label is drawn with half-circles at each end of the entry, but on my system they do not appear anomalous in any way.
    Randall Schulz
    iMac 20" Core Duo; MacBook Pro   Mac OS X (10.4.5)  

  • Selecting files of same color label in Applescript

    I am trying to write a script that will move files to a new folder based on the color label of the files.  So basically I want all files with a Red label to go to one folder, all Orange label files to go to a different folder etc.  I am having a problem figuring out how to select files by their color label.  I want this to be automated and not require any user input.  I have searched forums and even bought a couple books on Applescript but haven't been able to find my answer.
    Any information would be very helpful,
    Thanks
    Charles

    racinrandall wrote:
    However when I move the files to the remote folders, the original file is still in the original folder.
    The move command does the same thing as drag and drop
    Drag a file and drop it in another partition copy the file, you must press the Command key to move the file.
    But there is no command in the AppleScript Finder Dictionary to do this.
    First solution : the mv command in a do shell script :
    tell application "Finder"
          my moveFiles((files in folder "myfolder" whose label index is 1) as alias list, folder orangeFolder)
          my moveFiles((files in folder "myfolder" whose label index is 2) as alias list, folder anotherFolder)
    end tell
    on moveFiles(tFiles, destFolder)
          set tDir to quoted form of POSIX path of (destFolder as string)
          repeat with i in tFiles
                do shell script "/bin/mv -n " & (quoted form of POSIX path of i) & " " & tDir
          end repeat
    end moveFiles
    -- the -n option after /bin/mv equal  (Do not overwrite an existing file and the original file will not be moved)
    -- use -f option to replace an existing file
    Second solution : copy, delete and empty the trash
    tell application "Finder"
          with timeout of 0 seconds
                set orangeFiles to files in folder "myfolder" whose label index is 1
                if orangeFiles is not {} then
                      duplicate orangeFiles to folder orangeFolder without replacing -- or with replacing
                      delete orangeFiles -- move files to trash
                      empty the trash
                end if
          end timeout
    end tell

  • 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

  • Color label folders are not showing up when I do a "find"

    On my iMac 10.3 OS my colored folders show up but in my macbook pro 10.4.11 they do not. The images show up colored if I have put a color to them. I have selected "color label" in the "kind" box when I do a find but that doesn't help. I am REALLY used to making my more important folders a certain color so they are easier to spot when I do a "find". Is there a way to do this on a MacBook Pro 10.4.11 OS ?????????
    thanks for your time to reply if you can

    Yes it does and always has.
    Try testing with a new project.
    General advice is to always include your version of RoboHelp in posts and where applicable, the output you are creating.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • 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>

  • Recursively removing color labels in one go?

    Does anyone know a way to recursively remove color labels within a massive folder? Deep, deep nests exist in there and descending up and down the tree could take forever. Is there a way to select the top level folder and make all files and folders that have been color labelled to be reset to no color? The only way I have of doing it right now is to Find by label color, then select all files, then remove color, then move on to the next color....
    Message was edited by: Maxplanar

    Open the AppleScript Editor in the /Applications/Utilities/ folder, select the folder in the Finder, and run:
    tell application "Finder"
    set label index of every item of entire contents of (selection as alias) to 0
    end tell
    (47274)

  • 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

  • How to implement Mac OSX Finder color labels

    Is it possible to support color labels for files and folders in Mac OSX Finder in a custom connector? It would be nice to implement this in our connector as it's a common way for users to do some lightweight status workflow.
    If it's possible, a code sample would be really helpful.

    Is it possible to support color labels for files and folders in Mac OSX Finder in a custom connector? It would be nice to implement this in our connector as it's a common way for users to do some lightweight status workflow.
    If it's possible, a code sample would be really helpful.

  • 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?

  • Where can I find old prefs like color labels

    After installing a new OS on a new HD after a HD crash, I would like to copy old prefs and settings like color labels, mailboxes and messages, maybe the dock (to see which software was installed on the old HD). I have a back-up of the old system.

    If you were having no problem with prefs on your old system, you could just replace ~/Library/Preferences from your backup. You can do the same with other folders.
    Here's a list of where your important data is stored ("~" stands for "Home"):
    Your data in ~/Documents
    ~/Library/Application Support/AddressBook (copy the whole folder)
    ~/Library/Application Support/iCal(copy the whole folder)
    Also in ~/Library/Application Support (copy whatever else you need)
    ~ /Library/Keychains (copy the whole folder)
    ~/Library/Mail (copy the whole folder)
    ~/Library/Preferences/com.apple.mail.plist *This is a very important file which contains all email account settings and general mail preferences.
    ~ /Library/iTunes (copy the whole folder)
    ~/Library/Application Support/Safari (copy the whole folder)
    ~/Library/Application Support/iMovie (copy the whole folder)
    ~/Pictures/iPhoto library
    ~/Music/iTunes
    ~/Movies/iMovie
    If you want cookies:
    ~/Library/Cookies/Cookies.plist
    ~/Library/Application Support/Webfoundation/HTTPcookies.plist
    For Entourage users:
    Entourage is in Documents/Microsoft user data
    Also in ~ /Library/Preferences/Microsoft
    internet explorer favorites are in ~/Library/Preferences/Explorer/favorites.html
    -mj
    [email protected]

  • Can Bridge not read / see the Finder's color labels...?

    I have got a whole stack of images files, in a few nested folders on my Mac, and they have all been painstakingly individually color-labelled in the Finder with various colors.
    I now want to manage these files and perform various actions on them, based on their colors, and so I have opened up the folders in Bridge, but Bridge is not showing the colors of the files.
    I know Bridge has its own color-labels set-up, but this does not work in conjunction with the Finder, so even if I went through and re-labelled them all in Bridge, the changes would not be reflected in the Finder -- and I do still need to view the color-labels outside of Bridge / in the Finder, because I won't ONLY be using these files from within Bridge.
    So, simply put, is there no way I can get Bridge to read and display the color-label information as shown in the Finder?

    So, simply put, is there no way I can get Bridge to read and display the
    color-label information as shown in the Finder?
    No, you can't see those finder labels in Bridge.
    There is however a reasonable simply workaround I would think.
    In Finder create several new folders, for each label one folder.
    Open another Finder window and put this in column mode. Use view options in
    Finder and add the column 'label' to the window. Now press on the name label
    at top of this column and your labels are selected per color above each
    other.
    Drag and drop them manual to the new created folders. And you can easily
    repeat this for the other nested folders.
    You can also add the new color label folders temporally to the favorite
    column left at the finder window so drag and drop is even more easier.
    After this in Bridge point to each folder and assign a suitable bridge label
    color to it. Now you can work with Bridge color labels
    Also in Bridge you have options to rate with stars and add keywords so
    filtering has dozens of ways to retrieve your grouped files at once using
    the filter panel.

  • Bug in Aperture's Color labels?

    When I select an image and use the main menu to change the color label to nothing, viewing in the list view shows the label as "--" (without the quotes). When I use the sidebar to perform the same operation, the list view shows the label to be "No Label" (with the quotes). This seems inconsistent. Is this a bug?

    Yes, its been around since at least version 3.  While it doesn't cause a lot of problems in Aperture itself if you try to use Applescript to script the labels it causes all sorts of problems.
    I reported it numerous times, keep hoping that one day it will be fixed. You can send feedback to Apple reporting this, see Aperture->Provide Aperture Feedback
    regards

Maybe you are looking for

  • Where can I get a copy of iPhoto 8.1??

    The new iPhoto does not do what I loved about 8.1  ( I want my money back!!! )   Can anyone pooint me to 8.1 I can download??? Running on a Macbook Pro 10.6.7

  • REG:- SQL QUERY

    HI FRENDS MY PROBLEM IS IN BELOW QUERY select SUBSTR('Sales - Alternate Channels (Sub Department).Area Manager.1',1,7) from dual HERE I WANT TO TAKE ONLY 'SALES' FROM THE STRING. BUT SOME TIME INSTEAD OF SALES IT WILL COME 'Branch Operations' LIKE TH

  • BUG FOUND-- With Shadows on Non-FCP Generated Layers

    In FCP 6, this bug has been verified by many other users on forums across the web such as CreativeCow, DVCreators, and more. This BUG is a "repeatable problem" with the software. PLEASE take a moment to experiment with this so Apple can take care of

  • Scheduling procedure with remote db = logon denied

    I´m having two DBs (db1 and db2) which are connected by a database link and a non-dba user "xyz" in both DBs. I´m starting a procedure in db1, which catches data from a table in db2 and combines it with data from db1 - it works perfectly fine. Now I

  • Troubles installing catalyst drivers

    Hi I have given up having overheating graphics cards, and have decided to switch to the proprietary catalyst drivers for my dual radeon 6870 cards. However, every time I try to install them, something goes wrong and X ends up breaking, or dbus-launch