In Applescript, how to get the path of whatever document is showing in the VIEW/EDIT pane?

I’d like to use Applescript to get the path of whatever document is showing in the VIEW/EDIT pane. It shouldn’t matter if I had clicked on the document in the main ITEM LIST pane or the “See Also and Classify” pane.

I know how to get the path of the currently selected document in Applescript:

tell application "DEVONthink 3"
	set theSelection to the selection
	if (count of theSelection) is 1 then
		set theString to (path of (item 1 of theSelection))
	end if
	<do something with theString>
end tell

But “the selection” above refers to whatever is selected in the ITEM LIST pane, so this doesn’t work for me if the document being viewed was selected via See Also and Classify.

So, how to use Applescript to get the path of whatever document is showing in the VIEW/EDIT pane?

There are window objects with a property reflecting the currently viewed record

set theRecord to content record of think window 1
set thePath to (path of theRecord)
1 Like

Can you elaborate? I should have said, I’m a noob with Applescript. How do I get to the relevant window object?

meowky: It works, thank you!