How do open a document in a window in Devonthink using Applescript

Hi,
I have checked through the forum but still have vague idea on how do use Applescript to open a document window in Devonthink but could not find he Applescript code to do it.

So do explain, I have markdown file name “java_stuff.md” in database"software.dtBase2", and I want to open a document window for that file using Applescript. What is the Applescript code to do that?

thank

What is it that you do want to achieve here? What’s the context? In general, the method to open a document in AppleScript or JXA is open, as you can see in the scripting dictionary. And simply searching for open in the scripting dictionary might tell you what you want.

Example

tell application id "DNtp" 
	set theTaskTemplate to (get record with uuid "0538FAFE-BCDE-448C-8BDE-13E875EF34B0")
	set theWindow to open window for record (theTaskTemplate)
end tell

So do explain, I have markdown file name “java_stuff.md” in database"software.dtBase2", and I want to open a document window for that file using Applescript. What is the Applescript code to do that?

Why would you need scripting for this purpose?

1 Like

My use-case is an active task list (spreadsheet) that a script updates each morning
The script opens the document and inserts entries from my goal/project/task notes

BLUEFROG,
I use it to open a half-width document window to enter some note while going though a Udemy course in browser. I using keyboard maestro to open the document window through applescript.
So for example, if the Udemy course in browser is “Java Mastery” course, I use KM to detect the current course, and open a devonthink document “Java Mastery” in a document window.

I trying out with the following Applescript, and it seems to work

tell application "DEVONthink 3"

set dbase to get database named "udemy"

open window for record (record "Java Mastery" of dbase) with force

end tell