DT Deleting Tags Set By Hazel Rule

I use a ScanSnap to place documents in an ‘Action” folder; thereafter Hazel runs rules according to file contents. I have a routine that renames a file, and adds several tags before moving it to a DT group using that group’s UUID.

The tags show up for a brief moment and then are deleted inside DT. I have disabled all of my smart rules to ensure there is not a conflict there. The ‘Window —> Log’ does not show anything related.

Script and screenshot of Hazel rule follow…

tell application "Finder"
	set _path to (the POSIX path of theFile as string)
	set {_name, _extension} to {name, name extension} of theFile
	-- optional: hide extension in Finder
	set extension hidden of theFile to true
	-- optional: remove extension for DEVONthink displays
	set _name to text 1 thru -((count _extension) + 2) of _name
	set _extension to "." & _extension
end tell

-- Launch DEVONthink if it isn't already open.
tell application "System Events"
	if not (exists process "DEVONthink Pro Office") then
		tell application id "DNtp" to activate
	end if
end tell

-- Import the file.

tell application id "DNtp"
	set theGroup to get record with uuid "26E698F9-9479-4F45-8B26-473DE1CBEA2C"
	-- choose one option, Index or Import, comment out the other
	set theImport to import _path name _name to theGroup
	-- set theIndex to indicate _path to theGroup
end tell


The script’s code would be useful of course.


Posted and thanks

This is unnecessary and DEVONthink Pro Office shouldn’t be running on your (or anyone’s) machine nowadays. :wink:

Also, your rule and script:

  • Appear to be needlessly complicated and the criteria structured strangely.
  • What is your renaming step supposed to be doing here?

This works as expected, including no loss of tags…

And this can already be accomplished in DEVONthink via an indexed folder and a smart rule…

And a Change Name action could be added as well, if truly needed. :slight_smile:

As usual, thank you for correcting and educating me :slight_smile:

You’re most welcome :slight_smile:

Are you going to try using the smart rule?

And back to the original point… please let us know if the tags continue disappearing. If so, you have something else going on. :smiley:

The smart rule has been implemented after modifying for my use. The original script was surely from an old post, somewhere in the ether. The tags are added and remain! Thanks again.

My pleasure :slight_smile: