I have used the SetAttr META tags
internal command to set tags for a few thousand files. I can display these tags in a Lister by adding the Tags column, but I'd really like to add a custom column or two that would parse the contents of the tags
property. To do this I'd need to retrieve this property, using the equivalent of a GetAttr META tags
command. Is there any way to do this in a script?
Yes, you can get that via the MetaData object.
Depending on how complex your column is, you may also be able to do it more easily (and with greater performance) by using an Evaluator column instead of scripting: Preferences / File Display Columns / Evaluator Columns.
So far I've had no luck with the MetaData object. The first thing I tried was item.metadata.tags
, but that just returns an empty string even when the tag
property is set. I figured that the MetaData object didn't contain properties set by SetAttr META
, but maybe they're hidden somewhere else inside the object?
It returns a collection of strings, not a single string. You need to enumerate it to access the individual tags.
There's example code here: Scripts (JS & VBS) Snippet: Enumerating files and metadata tags
Thanks! That was just what I needed.