Turning group tags to normal tags


after years of working just with text files (Markdown) and the Finder and a short test of Evernote, I am back to DevonThink. :smiley:

Now, I imported the Evernote notebooks and want to autoclassify them. In order to be able to restore the order from Evernote, I have the groups (notebooks and notes combined with documents) tagged automatically (group tags) in this “Import from Evernote” database.

Problem is, as soon as groups are dissolved by autoclassification, the group tag will be gone as well.

How can I assign all group tags (mostly 2: from an integrated note and the notebook on top) to the documents as normal tags in order to be able to restore the earlier relations?

I am at war with AppleScript, unfortunately. – I am doing well with the Terminal, but AppleScript logic never got into my head :blush:


What have you tried?

PS: You had me at " I am doing well with the Terminal". :mrgreen:


I have tried converting some of the AppleScripts (particularly “Convert Comments to Tags” to create a tag from the folder name.

I can get a name from the groups in the top level (showing them in a dialog for checking whether it works), but I do not get into the groups , and I cannot put the variable into a for the documents.

tell application id "DNtp"
		set these_groups to the selection
		if these_groups is {} then error "Please select some groups."
		repeat with this_group in these_groups
			set this_tag to the name of this_group
			if this_tag is not "" then
				display dialog this_tag --fine
				set tags to text items of this_group --ERROR message:

(*DEVONthink Pro“ hat einen Fehler erhalten: tag of parent id 13762 of database id 2 kann nicht in Typ reference umgewandelt werden.*)
			end if
		end repeat
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

I also have problems getting into the subfolders that were created when a note contained some files.

I tried updating my knowledge about AppleScript yesterday, but it is not my world of logic; I did not get it in earlier years, and I won’t get it now.

PS After checking what “You had me” meant and the meaning of “Mr. Green”, I feel a bit relaxed. Huuuh, and a bit old… 8)


I am interested in the same problem. I’d like to know if anyone found a solution.


Just to add, I noticed when changing the names manually that DT will not let a group tag and a normal tag have the same name. In my manual workflow, I copy the name of the group tag, then rename the group tag to a new name, then apply the old name as normal tags to the files.

I’m not sure what you’re describing here. You can have a Tag and a group with the same name. Please post a screencapture of what you’re referring to.

I think these three screenshots can explain what I mean. In these examples, the database properties has the option “Exclude Groups from Tagging” unchecked .

In the following screenshot, the ABC group tag is presented in a grey highlight:
Group tag grey.png

When I add normal tags, they appear in blue:
Normal tag blue.png

But I can’t add a normal tag with the same name as the group tag. Nothing happens when the script “Add tags to selection” is executed:
Normal and group tags cant have same name.png

Actually, it is possible, but have you considered it may not be a good idea?
Screen Shot 2018-03-31 at 8.14.31 AM.png