Jump to content
_mk_

Mavericks Tags - File and Email Tagging with Alfred 2 (updated to v1.4)

Recommended Posts

Mavericks Tags - File and Email Tagging with Alfred 2
 
Features

  • Show tags of a file/folder or email
  • Add/Remove tags of a file/folder or email
  • Search files/folders or emails with a specific tag
  • Show list of available tags

Installation
 
Download and import into Alfred 2.
 
Usage
 
File Action
 
The Mavericks Tags workflow is available as Alfred File Action:
tag-fileaction.png
 
Hotkeys

  • ⌃⌥T - Show tags of selected file in Finder
  • ⌃⌥M - Show tags of selected email in Apple Mail

Select "Add Tag" and ENTER a tag name to add it as new tag to the file/folder/email or select one of the existing tags and press ENTER to remove the selected tag from the file/folder/email.
 
tag.png

tag-mail.png
 
Keywords

  • .tagged [tag name] - Search files/folder with tag

tagged.png

  • .taggedmail [tag name] - Search emails with tag

taggedmail.png

  • .taglist [tag name] - Show list of all available tags

taglist.png
 
Credits
 
Credit for the included command line utility go to jdberry.
 
The icons are from the Windows8/Metro Icon Pack by Visual Pharm.
 
Changes

  • 1.4 [2014-03-01]
    • "Manage Tags" file action now supports multiple file from Alfred's file buffer
  • 1.3 [2013-12-16]
    • ".taglist" command now uses mdfind to query all tags instead of the unreliable Finder plist
  • 1.2 [2013-12-10]
    • new keyword ".taglist" to show list of all available tags
    • renamed ".mtagged" keyword to ".taggedmail"
  • 1.1 [2013-11-25]
    • support for tagging emails
    • chnaged icons
Edited by _mk_

Share this post


Link to post

Hey _mk_,

 

This is a great idea, however I cannot seem to be able to tag any files or folders. I can search for tags just fine, but whenever I try to tag a file, a notification comes up saying: "terminating app due to uncaught exception...".

Share this post


Link to post

This is a nifty workflow – I noticed the utility a few days ago and have wondered if implementing a workflow based on it would make sense. This one is feature complete and well done, kudos: if you want tag management from the Alfred file browser, go for it, by all means.

 

However, and without wanting to denigrate the workflow, if all you need is a keyboard interface to tag management, I would suggest simply defining a hotkey for the Tags … command in System Preferences (hat tip to Brett Terpstra for the idea). It’s lightweight and integrated, and will offer autocomplete suggestions among other things.

 

Also, the workflow search is for user tags only – if you want and / or need to also search application specific tags like those set by Delicious Library, Evernote and others (aka Spotlight keywords – when Apple fixes CoreData Spotlight importing on Mavericks, that is), you might want to use a workflow based on an Alfred file filter (like my Tagg’d – sorry for the plug, really). The speed advantage James Berry’s utility claims over mdfind is entirely lost when using a workflow [EDIT: I didn’t pay attention: the workflow already uses a file filter] you will have to add kMDItemKeywords to the scope of its .tagged file filter, optionally also kMDItemOMUserTags for OpenMeta tags (essentially recreating my Tagg’d workflow).

 

Again, kudos for the workflow. Please consider the above a set of differentiating footnotes, not a fundamental critique. 

Edited by kopischke

Share this post


Link to post

Hey _mk_,

 

This is a great idea, however I cannot seem to be able to tag any files or folders. I can search for tags just fine, but whenever I try to tag a file, a notification comes up saying: "terminating app due to uncaught exception...".

 

Make sure to invoke the workflow either from Alfred file browser or with a hotkey to grab the Finder selection. I'll have to add some error handling in the next version.

Share this post


Link to post

This is a nifty workflow – I noticed the utility a few days ago and have wondered if implementing a workflow based on it would make sense. This one is feature complete and well done, kudos: if you want tag management from the Alfred file browser, go for it, by all means.

 

However, and without wanting to denigrate the workflow, if all you need is a keyboard interface to tag management, I would suggest simply defining a hotkey for the Tags … command in System Preferences (hat tip to Brett Terpstra for the idea). It’s lightweight and integrated, and will offer autocomplete suggestions among other things.

 

Also, the workflow search is for user tags only – if you want and / or need to also search application specific tags like those set by Delicious Library, Evernote and others (aka Spotlight keywords – when Apple fixes CoreData Spotlight importing on Mavericks, that is), you might want to use a workflow based on an Alfred file filter (like my Tagg’d – sorry for the plug, really). The speed advantage James Berry’s utility claims over mdfind is entirely lost when using a workflow.

 

Again, kudos for the workflow. Please consider the above a set of differentiating footnotes, not a fundamental critique. 

 

I do not treat your feedback as criticism ... don't worry.

 

If one uses Finder to tag files, Brett's hotkey tip may be the best solution. But if one (like me) uses Alfred for most of the stuff, the workflow should come in handy. I also have a few more features in mind to make it even more useful.

 

I also use a File Filter to display tagged files instead of the cli utility. I just omitted OpenMeta tags, as they are already very well covered by your workflow. I usually do not like to reinvent the wheel... :)

Share this post


Link to post

I also use a File Filter to display tagged files instead of the cli utility. I just omitted OpenMeta tags, as they are already very well covered by your workflow. I usually do not like to reinvent the wheel... :)

 

Hah, looks like I jumped to conclusions when checking out your workflow, I assumed you were using the cli’s search functionality for the filter. With a file filter, adding application tags would just involve adding kMDItemKeywords to the queried fields, of course. Well done  ^_^ . Also, only ever so slightly OT: noticed this already?

Share this post


Link to post

...Also, only ever so slightly OT: noticed this already?

 

German translations are almost always dubious if not misleading. I therefore switched my Mac's GUI language to English long time ago.

Share this post


Link to post

:D Apple's German translations are horrific. Windows in German is just fine (other than being Windows), but OS X in German is demented.

 

Ablage vs Datei or Sichern vs Speichern are kinda okay, but they've done some really insane things. On the iPhone, "Aktualisierungen" spread across, like, three buttons in the App Store app, and the "kostenlos" button in the iTunes app made it impossible to see the title of the podcast/track you were looking at. I'm sure there are much better (worse?) examples.

 

My favourite was Flash's translations of "level" and "layer" (very different things in Flash). Both "Ebene" in German. Bravo!

 

My favourite non-IT translation that I've come across was for the "hydraulic ram" on a large machine tool. Hydraulischer Widder. Epic! (For non German-speakers, "hydraulischer Widder" means "hydraulic male goat".)

Edited by deanishe

Share this post


Link to post

German translations are almost always dubious if not misleading. I therefore switched my Mac's GUI language to English long time ago.

 

:D Apple's German translations are horrific. Windows in German is just fine (other than being Windows), but OS X in German is demented.

 

Ablage vs Datei or Sichern vs Speichern are kinda okay, but they've done some really insane things. On the iPhone, "Aktualisierungen" spread across, like, three buttons in the App Store app, and the "kostenlos" button in the iTunes app made it impossible to see the title of the podcast/track you were looking at. I'm sure there are much better (worse?) examples.

 

My favourite was Flash's translations of "level" and "layer" (very different things in Flash). Both "Ebene" in German. Bravo!

 

My favourite non-IT translation that I've come across was for the "hydraulic ram" on a large machine tool. Hydraulischer Widder. Epic! (For non German-speakers, "hydraulischer Widder" means "hydraulic male goat".)

 

Well, I keep hoping … and, in the meantime, filing localization related radars  :).

Edited by kopischke

Share this post


Link to post

Those are truly insane translations.

 

 

I'm not surprised. "Worte" and "Wörter" have clearly distinct meanings that have nothing to do with tags or keywords.

 

It should confuse the hell out of anyone that understands the difference. "Key words" vs "keywords" doesn't really capture the total dumbness of the mistake. I'm not sure you can in English. Tags are Tags.

 

Why does Apple always have to come up with a different, wrong translation for everything?

Share this post


Link to post

I didn't know about bugreport.apple.com. I just filed a bug re Apple Maps and the city where I live, Essen.

 

Every single business gets a restaurant icon, even the local prison  :rolleyes:

 

(For non German-speakers, Essen is both a (fairly large) city and German for "food".)

Share this post


Link to post

I didn't know about bugreport.apple.com. I just filed a bug re Apple Maps and the city where I live, Essen.

 

Yeah, it’s meant to be a dev tool, but it’s accessible to anybody with a free developer account, not just paid members of the iOS and OS X programs. The openradar mirror exists because the bug reports are only visible to the submitter, which makes it rather difficult to assess if the issue has already been noticed by others, and what patterns they have noticed…

 

Every single business [in Essen] gets a restaurant icon, even the local prison   :rolleyes:

 

:blink: *mind blown

Edited by kopischke

Share this post


Link to post

Those are truly insane translations.

 

 

I'm not surprised. "Worte" and "Wörter" have clearly distinct meanings that have nothing to do with tags or keywords.

 

It should confuse the hell out of anyone that understands the difference. "Key words" vs "keywords" doesn't really capture the total dumbness of the mistake. I'm not sure you can in English. Tags are Tags.

 

Why does Apple always have to come up with a different, wrong translation for everything?

 

Well, actually, “Schlagworte” has a tradition in indexing contexts (albeit not computer based ones), so that wouldn’t have been too bad a a choice for either term, but not for both (and differentiating by subverting German grammar is … umh [to English speakers: it’s a bit as if keywords and tags were called, respectively, “keywords” and “keywordz”]).

Share this post


Link to post

:D  "keywordz". I like that. It's definitely better than mine.

 

BTW: Should I also file my bug report on openradar, then?

Edited by deanishe

Share this post


Link to post

:D  "keywordz". I like that. It's definitely better than mine.

 

BTW: Should I also file my bug report on openradar, then?

 

Duplicating a bug report on Open radar is always good.

Share this post


Link to post

It is not working for me. Please, have a look to log:

 

2013-11-19 12:21:12.479 tag[13340:507] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff910c841c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff96734e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff90f898b7 -[__NSArrayM insertObject:atIndex:] + 951
    3   tag                                 0x00000001075b209c tag + 4252
    4   tag                                 0x00000001075b4195 tag + 12693
    5   libdyld.dylib                       0x00007fff909f55fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Share this post


Link to post

The workflow was updated to version 1.1:

 

New Features:

  • tag multiple files at once
  • add multiple tags at once (separated by comma: tag1,tag2,tag3)
  • tag email in Apple Mail

Share this post


Link to post

Thanks for the update, is there any way to make a Smart Folder in Mail.app based on tags?

 

No, unfortunately not. But you could create a Smart Folder in Finder or use spotlight:

tag:<tagname> kind:mail

You can avoid the tag: prefix but I usually keep it for better visualization.

Share this post


Link to post

 

The workflow was updated to version 1.2:

 

New Features:

  • new keyword ".taglist" to show all available tags

 

 

I applaud your ingenuity in using the Finder prefs to find all the tags, but that doesn't list all the tags on the system. It's a subset.

Share this post


Link to post

I applaud your ingenuity in using the Finder prefs to find all the tags, but that doesn't list all the tags on the system. It's a subset.

 

This uses the view settings of the tags shown by "All Tags" in Finder. Not sure if there is a "critical mass" that stops Finder from storing the tags in its prefs. Haven't found any other way until now. Suggestions are welcome.

Edited by _mk_

Share this post


Link to post

This uses the view settings of the tags shown by "All Tags" in Finder. Not sure if there is a "critical mass" that stops Finder from storing the tags in its prefs. Haven't found any other way until now. Suggestions are welcome.

 

I wish I had a suggestion as well. :-) I was looking for exactly this a while back and the only reliable way I found was to brute force it, extracting tags out of every tagged file then collating the results. Obviously Finder has a way to get that list, so somebody needs to trace Finder and see where it's pulling that list from.

Share this post


Link to post

I checked with fseventer and the only file that gets modified when I create a new / rename an existing tag is ~/Preferences/com.apple.finder.plist. That's the one I parse for the tag list. So either fseventer misses some "special" system files that get modified or Apple uses another fancy technique to gather all tags in Finder.

 

This really drives me nuts. On the one hand I am so happy that Apple finally jumped on the tagging train but on the other hand I am quite disappointed by how incomplete this new feature was delivered. There is no official CLI, no AppleScript support,... :(

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...