I am having difficulty with a simple JXA script to save a file to a specific group in DEVONthink. I have tried a number of very similar code snippets from this forum, all of which are said to work, but with no success for me in my environment.
I have trimmed the code down as much as possible to highlight the problem that I am having.
The code uses constants for the file name and the destination UUID, then tries to import the file to the destination group.
It looks to me like the import action is not behaving for me in the same way as it did for others but I can’t find any reference to any recent changes to the import interface.
Here is my JXA script:
dt = Application("DEVONthink");
const file = "/Users/paul/Downloads/Statements/Unknown.pdf";
const uuid = "C98D0C6F-DADB-4146-9D40-860287F63915";
const destGroup = dt.getRecordWithUuid(uuid);
console.log(destGroup.name()); //Statements, as expected
const record = dt.import(file, {to: destGroup}); //execution error: Error: Error: Message not understood. (-1708)
and here is what I see in the debug info from Script Editor
- Messages
/* Statements */
Result:
Error -1708: Message not understood.
- Events
app = Application("DEVONthink")
app.getRecordWithUuid("C98D0C6F-DADB-4146-9D40-860287F63915")
app.databases.byId(2).parents.byId(9464).name()
/* Statements */
app = Application("DEVONthink")
app.import(["/Users/paul/Downloads/Statements/Unknown.pdf", {"to":app.databases.byId(2).parents.byId(9464)}])
Result:
Error -1708: Message not understood.
- Replies
app = Application("DEVONthink")
app.getRecordWithUuid("C98D0C6F-DADB-4146-9D40-860287F63915")
--> app.databases.byId(2).parents.byId(9464)
app.databases.byId(2).parents.byId(9464).name()
--> "Statements"
/* Statements */
app = Application("DEVONthink")
app.import(["/Users/paul/Downloads/Statements/Unknown.pdf", {"to":app.databases.byId(2).parents.byId(9464)}])
--> Error -1708: Message not understood.
I have spent hours making small changes but can’t make any progress. Hopefully someone can see my obvious coding error, or point out what I am surely missing about the import interface.

