# JXA script using app.import() to \`import\` file to specific group

**URL:** https://discourse.devontechnologies.com/t/jxa-script-using-app-import-to-import-file-to-specific-group/86345
**Category:** Automation
**Created:** [February 18, 2026, 6:39am UTC](https://discourse.devontechnologies.com/t/jxa-script-using-app-import-to-import-file-to-specific-group/86345 "2026-02-18T06:39:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pfarrelle](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/6f9a4e/32.png) [@pfarrelle](https://discourse.devontechnologies.com/u/pfarrelle)
#### Post date: [February 18, 2026, 6:39am UTC](https://discourse.devontechnologies.com/t/jxa-script-using-app-import-to-import-file-to-specific-group/86345/1 "2026-02-18T06:39:09Z")

</div>

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:

```javascript
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

1. Messages

```javascript
/* Statements */
Result:
Error -1708: Message not understood.

```

1. Events

```javascript
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.

```

1. Replies

```javascript
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.

---

<div class="post-metadata">

### Author: ![cgrunenberg](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/cgrunenberg/32/7172_2.png) [@cgrunenberg](https://discourse.devontechnologies.com/u/cgrunenberg)
#### Post date: [February 18, 2026, 7:01am UTC](https://discourse.devontechnologies.com/t/jxa-script-using-app-import-to-import-file-to-specific-group/86345/2 "2026-02-18T07:01:45Z")

</div>

JXA doesn’t support synonyms contrary to AppleScript, the name of the command is `importPath` since version 4:

 ![Screenshot 2026-02-18 at 7.59.55 AM](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/4/b/4b11be7dfca39566dac1518680556a91a64af9cc.jpeg)

Just drag & drop DEVONthink 4 onto the Script Editor.app to view its complete script suite.

---

<div class="post-metadata">

### Author: ![pfarrelle](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/6f9a4e/32.png) [@pfarrelle](https://discourse.devontechnologies.com/u/pfarrelle)
#### Post date: [February 18, 2026, 7:16am UTC](https://discourse.devontechnologies.com/t/jxa-script-using-app-import-to-import-file-to-specific-group/86345/3 "2026-02-18T07:16:16Z")

</div>

Thanks for the quick response. That fixed it, so now I can do some “real” work 😉 .

---

<div class="post-metadata">

### Author: ![pfarrelle](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/6f9a4e/32.png) [@pfarrelle](https://discourse.devontechnologies.com/u/pfarrelle)
#### Post date: [February 18, 2026, 7:29am UTC](https://discourse.devontechnologies.com/t/jxa-script-using-app-import-to-import-file-to-specific-group/86345/4 "2026-02-18T07:29:17Z")

</div>

I’m feeling quite stupid. I am familiar with the dictionary in Script Editor, but didn’t realize that the there is an `AppleScript/JavaScript/Objective-C` drop down selector. Why would I, all my previous endeavors were with AppleScript, so I have been looking at:

 ![Screenshot 2026-02-17 at 11.21.44 PM](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/e/c/ec2ca54e4f4f3a43108c0f40c7d9f90d867389ef.jpeg)

the AppleScript version, and simply trying to infer the JXA equivalent. I did try importpath() at one point, but missed the Camel notation.

The entries are essentially the same, with ImportPath() also indicating a synonym (which is a little misleading), but there is no import() entry in the JXA version.

Thanks again @cgrunenberg !
