Editing Finder Comments

I am having some trouble doing this, so I have to ask - is it permissible to modify Finder Comments for files from an App Store app, written in xCode?


If so, is it best to try and do it with SwiftUI or execute an Apple Script?


All of the Swift I have tried does not seem to actually save the Comment to be able to retrieve it in Finder.


Edit: my goal is to be able to search for files with Finder/Spotlight and have them show up based off of this metadata that I want to add - if you have another suggested way of doing this, I am all ears.


TIA!

Mac mini

Posted on Apr 10, 2024 12:50 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 13, 2024 12:31 PM

Jay in Detroit wrote:

I like your suggestion, but I really want to know how to do this. I know it is possible because Metamer does it and now I need to know what the secret is.


What was linked earlier discusses the two types of comments, and which of the two to use for most applications. And particularly which to use, given the mess around .DS_Store. Use com.apple.metadata:kMDItemComment, not com.apple.metadata:kMDItemFinderComment. Put differently, your Swift code seems to have fallen directly into the .DS_Store problem that the article warned about.


AppleScript is useful for scripting GUI apps and when no alternatives or APIs exist, but too often tends show its limits for other uses.

18 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Editing Finder Comments

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.