Update: I made some progress based on this post
tell application id "DNtp"
set theRecord to create record with {name:theQuery, type:text, content:theQuery} in inbox
set theFile to path of theRecord as POSIX file
tell application "Finder" to open theFile
end tell
It opens the files in apps that are set to handle the file type. In my case BBEdit. Not DEVONthink. I'm guessing because DEVONthink doesn't understand POSIX files?
Thanks, oddly I can't get DEVONthink to open the record. The following passes the debugger, but doesn't work.
tell application id "DNtp"
create record with {name:theQuery, type:text, content:theQuery} in inbox
open theQuery
activate
end tell