Hello,
I have a enormous amount of files that have Open Meta tags.
I’m still running under Mojave so for now I can use the openMeta CLI and apps to handle those tags but I want to prepare for a future OS update.
Ultimate goal is to migrate all OM tags to System tags.
I have made a script that can do that under Mojave but I wanted to also make one that could run on a more recent OS.
There as nice routines in ASObjC to handle System tags:
to readTags(filePath) – get current tags
set theURL to current application’s NSURL’s fileURLWithPath:(POSIX path of filePath)
set {theResult, theTags} to theURL’s getResourceValue:(reference) forKey:(current application’s NSURLTagNamesKey) |error|:(missing value)
if theTags is equal to missing value then return {} – no items
return theTags as list
end readTags
to writeTags(tagList, filePath) – set tags
set theURL to current application’s NSURL’s fileURLWithPath:(POSIX path of filePath)
theURL’s setResourceValue:tagList forKey:(current application’s NSURLTagNamesKey) |error|:(missing value)
end writeTags
and my question is : Is there a way to do the same with ASObjC for OM Tags ( kMDItemOMUserTags )
(how to substitute NSURLTagNamesKey with kMDItemOMUserTags )
I would need 2 similar functions to Read and Write OpenMeta tags.
(I know I can use "mdls -name kMDItemOMUserTags” shell command to retrieve them but there is quite a delay until it detects changes and some more annoying issues with tags containing diacritical marks (that are encoded in a weird way that I don’t know how to transform in normal text))
And , for saving OM tags , would it be enough to have Spotlight index them properly. ( I think that currently the OpenMeta CLI use some tricks to force Spotlight to index its keywords. ( setattrs ? )
Thanks for any help.
Regards to all.