Page 1 of 1

Color folder based on contents

PostPosted: Wed Aug 19, 2009 3:41 am
by invictus26
Hi, I'm trying to set the color label of a folder based on the "worst" label within the folder. I have the files inside the folder labeled by how long they've been in there, going from green to yellow to orange to red. I saw the applescript which moves focus to the containing folder, but the label is replaced for every file in the folder. So if I have one red file surrounded by green files, the containing folder will be green. Is there a way to get what I'm looking for? Let me know if I'm not making sense. Thanks for your help,

-Matt

Re: Color folder based on contents

PostPosted: Wed Aug 19, 2009 1:15 pm
by Mr_Noodle
I'm not sure what the actual rules are that you have in mind but from what I can tell of it, I think you're going to have to code that logic in a script.

Re: Color folder based on contents

PostPosted: Thu Aug 20, 2009 8:20 pm
by invictus26
Ok, so I combined several rules which seems to work at least in part. This set is for orange files, but I have others sets for other colors.

Inside the folder, this rule adds the colors of each file to the containing folder:
Image

Then this rule finds the "worst" color in the comments and sets the color label of the folder to that:
Image

This rule goes through and refreshes the comments every hour in case the contents have changed:
Image

I'll have to wait and see how well these work out, but it seems like there must be a better way than setting comments like this. Any ideas?

Re: Color folder based on contents

PostPosted: Sun Aug 23, 2009 3:29 pm
by Mr_Noodle
I'm not sure I'm following the logic in this ruleset but if it's working for you then so be it. I think the way to go would be to put more logic in the script. Looking at your rules, it seems like you are assuming a universe of only orange and red files which may be true in your case but I think a more robust way to do it is to put more of this logic in a script.

Re: Color folder based on contents

PostPosted: Sun Aug 23, 2009 4:03 pm
by invictus26
It's actually not working out very well. I really don't know any applescript, so I can't really add any logic to it. I don't even know how I would go about it. The problem is that I need to look at all of the contents in the folder, but the rules only look at each file individually. Is there a way to scan through the colors of all the contents?

Re: Color folder based on contents

PostPosted: Mon Aug 24, 2009 11:37 am
by Mr_Noodle
Again, for custom logic like this, scripting is the way to go. You might be able to work something out by avoiding scripting but I suspect it will be a lot more complicated to deal with. If someone else has the time, maybe they can do the script for you. You might also want to poke around some AppleScript boards.