Please enclose code in three backticks like so
```
code goes here
```
That highlights it correctly, makes it stand out, and also adds the copy button at the top right that allows people to easily copy/paste your code. I’ve modified your post accordingly.
To your questions…
set moj_loc to "\/00 Test\/10 Inbox"
the backslashes do nothing there but obfuscate the code. Slashes in a string are nothing special that would merit escaping with a backslash.
create record with {name:theQuery, content:(cd as string), location:(moj_loc), type:rtf})
Now, the documentation of create record with
states:
create record with v : Create a new record.
create record with [record]: The properties of the record (‘name’, ‘type’, ‘comment’, ‘aliases’, ‘path’, ‘URL’, ‘creation date’, ‘modification date’, ‘date’, ‘plain text’, ‘rich text’, ‘source’, ‘data’, ‘content’, ‘columns’, ‘cells’, ‘thumbnail’ and ‘tags’ are possible values).
in [record]: The destination group for the new record. Uses incoming group or group selector if not specified.
location
, as in your code, is not mentioned. I guess what you want to achieve is to store your record in the group /00 Test/10 Inbox
(the choice of Inbox
for a group is a bit unfortunate, as Inbox
is a default group in every database). Then you should use the in
parameter for that. Something along these lines, perhaps (I’m not an AppleScript person, so the code might not quite work as it is):
set moj_loc to create location "/00 Test/10 Inbox"
set moj_record to create record with {name:theQuery, content:(cd as string), type:rtf} in moj_loc
I also removed the unneeded parenthesis.
If you feel uncomfortable with AppleScript, you could achieve the same result with JavaScript, e.g.
const app = Application("DEVONthink 3");
…
const moj_loc = app.createLocation("/00 Test/10 Inbox");
const moj_rec = app.createRecordWith({name: theQuery, content: cd, type: "rtf"}, {in: moj_loc});
(not too many differences there, though).