Automatically assign tag to pdf items in smart folder

If this has already been addressed and I missed it, sorry for the duplicate.

I am familiar with the manual way of selecting all documents in a given smart group and then assigning them the proper tag, however, this is cumbersome when pdfs belonging to different smart groups are frequently added.

As such, I am wondering if it’s possible to automatically append a particular tag to each pdf in a given smart group? I suspect this is doable by attaching a folder script to each smart group. More than anything, I lack the scripting know-how to experiment with this.

This tagging seems useful (at least to me) in at least two regards.

  1. Unless I’m mistaken, you cannot quickly assess the intersection between documents present in two different smart groups without manually creating a new smart group with the combined search criteria. However, if you assign a common tag to all pdfs in a given smart group, you can quickly assess the intersection between documents by selecting both tags in the Tag View.

  2. Assigning tags to all pdfs in a given smart group provides a means of categorizing/organizing documents that is transferable with the documents themselves. For example, pdf documents that are organized and tagged in Devonthink, can be organized/searched similarly based on those tags in a different program that can filter based on tag name (e.g., a citation manager, I use Bookends).

It’s also possible that tagging pdfs in this manner is a bad idea for reasons other than I’ve considered. In either case I’d appreciate any script ideas or comments that may be useful. Thanks for your help.

Not yet but this will be definitely possible in a future release.

This wouldn’t be supported by global smart groups, only by smart groups in databases. And it would be necessary to open or select the smart group to semi-automatically execute the triggered script which might look like this:

on triggered(theRecord)
	tell application id "DNtp"
		set theChildren to children of theRecord
		repeat with theChild in theChildren
			set theTags to tags of theChild
			set theTags to theTags & "My Tag"
			set tags of theChild to theTags
		end repeat
	end tell
end triggered

Thank you very much for your response and the useful suggestion!