Touching Tags, continued...

I thought I’d continue my comments on this thread:
http://www.devon-technologies.com/scripts/userforum/viewtopic.php?f=3&t=11212
here in “DT Scripting.”

I tried an approach that created a tag group, and tagged by making children in the tag group, but it’s clear that this approach doesn’t tell DTPO that it should export OpenMeta tags to indexed files:

tell application "DEVONthink Pro"
	set theTagGroup to parent "Tags" of database 1
	set tmpTag to create record with {name:"foveogan", type:group} in theTagGroup
	set theContents to contents of database 1
	repeat with i in theContents
		replicate record i to tmpTag
	end repeat
	-- delete record tmpTag
end tell

To conclude, a question and a comment:

Question: I didn’t find very many examples of creating tag groups and assigning records to them, so I borrowed on what I know about replicating. If anyone has comments and suggestions about my scripting approach, I’d be very appreciative.

Comment: one thing I discovered with hierarchical tags is that if you reindex, the hierarchy is flattened. It’s still there in a sense, but the enclosing groups refer to the files directly, and not to the original tags. In retrospect, it’s pretty obvious that this would happen, but a little startling to actually experience it. So hierarchical tags on indexed files are pretty fugitive.

Best, Charles

Thanks for posting this script! Here’s a slightly revised version:


tell application "DEVONthink Pro"
	set theContents to contents of current database
	repeat with i in theContents
		set theTags to parents of i
		set theTags to theTags & "foveogan"
		set tags of i to theTags
	end repeat
end tell

Oh hey, brilliant! Thanks, Christian…