How to open specific document?

Is it possible to open a specific DTP document via AppleScript? I apologize if this is too elementary a question, but after much trial and error, as well as searching of the forum, I still haven’t managed to figure out how to do it. (I have some large terminology files in my database and am trying to automate the process of searching specific files.) Any leads would be much appreciated.


tell application "DEVONthink Pro"
	set theSearchName to "A Uniquely-named document"
	set theSearchItems to search theSearchName comparison exact within titles
	set theSearchResult to the rich text of item 1 of theTemplateItems
end tell

theSearchResult is the file you’re looking for. Ensure that it’s a file with a very unique name, otherwise it’ll just return the first result, which might not be the one you want and could cause you to enter a world of pain.

Many thanks for this code. In the end I decided that, all things considered, it would be better to use a FileMaker database. But the code will certainly come in useful in the future.