I have a script that allows me to add tags to files only by right clicking on them. I select the tags and the script adds them automatically. They have a specific form: "&tag" and they are separated with white spaces.
What I'd like to do is to have an automator application, where a shell script searches for files by a certain criteria and that script passes the result to an applescript.
So my automator app starts with a "Run Shell Script" block and that's the only thing in it.
mdfind '(kMDItemContentTypeTree == "public.image" || kMDItemContentTypeTree == "public.video") && kMDItemFinderComment == "*&tag*"cd'
This returns a list of files with their POSIX paths. Like this: {"/User/path1/file1","/User/path2/file2",etc.}
Then I have a "Run Applescript" box, where I'd like to access the files and their comments, but no matter how much I try, it does not work. I've tried using POSIX files, or accessing the comments from a "tell finder" block.. Nothing worked.
This is the simple most code, that I think should work just fine, but it doesn't!
on run {input, parameters}
repeat with f in input
display dialog (comment of f) as text
end repeat
return input
end run
Does anyone have any ideas what the problem might be? What am I missing? Help me please!
Thanks!