Understanding lock function & lock inheritance


I have a couple of questions about the ‘lock’ property that can be assigned to folders and files in DevonThink Pro.

  1. I’ve read the manual and consulted the forums for information about the ‘lock’ function. And, as far as I can tell it prevents documents from being deleted or modified in any way. The question I have is, for an indexed folder or file is applying the ‘lock’ property a way to avoid absolutely any modifications of the file from within DTPro? Here’s a little background on my question:

I ask because I’d like to index RTF files and other text data from TAMS Analyzer (http://tamsys.sourceforge.net/), a qualitative coding and analysis software package. However, the developer advises users to avoid opening RTF files in any other application. I corresponded with him about this and he said: “I suspect that DEVON like tams uses Apple’s rtf engine and thus the files should be okay, but you never know!”

Naturally, If I implemented DTPro indexing of TAMS Analyzer data I would back up the TAMS data outside of DTPro. However, I’m hoping to hear from someone who may have confronted this issue before or has a solid understanding of how DTPro handles indexed RTF and text files.

  1. My second question is much simpler: is there a way to lock an indexed folder and all folders and files contained therein?

Thanks for your time,


Locked groups/smart groups/feeds can’t be deleted, locked documents can’t be deleted/edited. But it’s still possible to rename them, add a comment, change the label etc.

Just select the groups/documents and run this script:

tell application "DEVONthink Pro"
		set this_selection to the selection
		if this_selection is {} then error "Please select some contents."
		my lockItems(this_selection)
	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

on lockItems(theseRecords)
	local this_record
	tell application "DEVONthink Pro"
		repeat with this_record in theseRecords
			set locking of this_record to true
			if type of this_record is group then my lockItems(children of this_record)
		end repeat
	end tell
end lockItems

Be aware that locked documents can be “deleted” using Edit > Delete, but locking prevents then from going down the drain when Empty the Trash is selected - the locked document merely stays behind in the trash folders.

If a locked document is part of a group, and the group is deleted and the trash emptied, the parent group(s) also stay in the trash until the locked document is unlocked. Groups respect their children’s locked status as long as it is the group that is deleted first, and not its children.

Locked documents can be opened and edited in the associated external editor(s) for that document. For example, locked .rtfs can be opened and edited in TextEdit; locked .docs can be opened and edited in Word, and so forth.

Obviously, but sometimes forgotten: duplicated and replicated locked documents inherit the locked status. Unlocking locked replicants unlocks all related replicants. Not so with duplicates - they stay locked.

Thanks to both of you for this information. I feel much better about indexing my TAMS Analyzer RTFs now.