Filing based on tags

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Filing based on tags Mon Feb 09, 2009 6:28 pm • by invictus26
Hi, I would like to use Hazel to organize my files into folders based on tags (spotlight comments). I have two problems with this. First, my tags all have a prefix (&), so if I have the files put into subfolders based on comment, they have the form "&tagname" which isn't desirable. I'm basically wondering if there's a way to have it name the folder by whatever comes after the prefix.

Alternatively, I'm considering using the program "Tags" by Gravity. It works really well and uses an alternative to spotlight comments which doesn't require a prefix. Using this, I get good folder names, but if I have more than one tag, it creates folders like "tag1, tag2" and if any of the other tags are different, they are filed in different folders. Is there some way to choose the first tag for example?

Thanks for any help you can give me. Also, if there is another tagging program that people use that works well, I'd be interested in that as well. Thanks!
invictus26
 
Posts: 16
Joined: Mon Feb 09, 2009 6:15 pm

Re: Filing based on tags Tue Feb 10, 2009 3:39 am • by alastor933
All tagging apps to date use a single attribute to store tags: Spotlight comments and/or an extended attribute of their own. So any tags must be considered to be in a list.

This is a make-do solution at best.

I think you need to use applescript to manipulate these unstructured tag heaps.
alastor933
 
Posts: 53
Joined: Wed Mar 05, 2008 3:52 pm
Location: Utrecht, Netherlands

Re: Filing based on tags Tue Feb 10, 2009 6:52 pm • by Mr_Noodle
If there is only a single tag in the Spotlight comment, you can use "matches". Something like:

&(•mytag)

where (•mytag) is a custom token. Define the mytag token to match a word. If this is all going over your head, look up "match patterns" in the help.

If you do the above, then the mytag token will contain just the text after the &.

The problem, though, is that you have multiple tags. If you have them in the Spotlight comments and want to grab the first one, you can amend the above patterns as follow:

&(•mytag)(...)

You basically add the "anything" token meaning that anything can appear after that first tag (including nothing). Since mytag is defined as matching a word, once it encounters a non-word character (like a comma), it stops grabbing text for that token.

I believe "Tags" (the program) uses OpenMeta (see the other thread here on that). There's no integrated support for OpenMeta in Hazel at the moment. You can tie into it by matching against the appropriate Spotlight attributes in combination with a shell script to set tags (again, see the thread). The problem is that the "tags" Spotlight attribute is a list of tags and there's no "matches" operator for lists right now so you couldn't use the above technique. I'll have to think about either providing some sort of pattern matching to attributes that are lists or maybe more directly just providing a way to grab common items from a list (like the first and last item).

The above is a bit hairy so let me know if you need more help with it.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Filing based on tags Wed Feb 11, 2009 12:24 am • by invictus26
That worked perfectly!!! Thank you so much. I think I will use quicksilver to add a spotlight comment tag which I'll use for filing and I'll use Tags by Gravity Software for the actual tagging since it's so much more user friendly. I might look into using the first tag for filing later on. Thanks again for your help.
invictus26
 
Posts: 16
Joined: Mon Feb 09, 2009 6:15 pm

Re: Filing based on tags Wed Feb 11, 2009 1:03 am • by invictus26
Ok, I just thought a bit more about it, and I can see how being able to match using tags would be amazing. I would use the first couple of tags for filing (creating various folders and sub-folders) and the rest for searching. Is there any word on openmeta being implemented soon? Thanks again
invictus26
 
Posts: 16
Joined: Mon Feb 09, 2009 6:15 pm

Re: Filing based on tags Wed Feb 11, 2009 1:58 pm • by Mr_Noodle
It's still not clear how the matching would work across a list of items so I need to think about that more. One thing that is more straightforward is, when using an attribute that is a list, have a formatting setting where you can tell it to use the whole list or select the first or last item (it would be a contextual menu like how you can capitalize some attributes now).

You mentioned "first couple" though it's unclear to me how you would use that. While first and last can be guaranteed to make sense, anything beyond that is unclear since Hazel doesn't know how many items are going to be in the list when it's presenting the interface. If you could describe in more concrete terms what you are trying to do, that would help.

OpenMeta is still under consideration. There are issues with scheduling as well as whether it is the correct long term solution. While something like it is definitely needed, I need to make sure the implementation is something that won't be broken by Apple in future updates.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Filing based on tags Wed Feb 11, 2009 5:09 pm • by invictus26
By "first couple" I meant something like this:

I give a file tags: Tag 1 Tag 2 Tag 3 Tag 4
In Hazel I set up matching: (abc)-->(abc) [depending on the format]
Hazel sorts the file into a folder structure:

-MainFolder
--Tag 1
---Tag 2

That would leave Tag 3 and Tag 4 for any other information I want to add. Obviously I could change my matching criteria to change the number of tags that are used for filing. I don't know if I'm explaining this very well. I made an example rule that does it using spotlight comments, but I can't seem to upload the file. Here's a screenshot of the rule.

Image
invictus26
 
Posts: 16
Joined: Mon Feb 09, 2009 6:15 pm

Re: Filing based on tags Tue Feb 17, 2009 2:51 pm • by Mr_Noodle
Thanks for sharing that. Again, I need to figure out how some of this is going to work but it helps to have concrete cases that I can design against.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Filing based on tags Sun Mar 15, 2009 7:54 pm • by BLUEFROG
Hey, Mr_Noodle…

I don't know if you've seen the developer of Default Folder X is fully supporting OpenMeta and has posted a lengthy monologue about why at this URL: http://ironicsoftware.com/community/comments.php?DiscussionID=755&page=1#Item_19

I invite you to join us at the new Google Group we've set up for developers to discuss the OpenMeta Initiative. http://groups.google.com/group/openmeta?pli=1 (Don't worry, no salesman will call) ;^)

Hope to see you there soon. Cheers!
BLUEFROG
 
Posts: 1
Joined: Mon Jan 19, 2009 12:37 pm


Return to Support