Applescript access denied issues with import to

I’m trying to create an Applescript that creates a diary entry when triggered. I can successfully import a template file into the database, but when I get try to get use the import command to set the record I get an “access denied” error when saving the applescript file.

In my script I use the following command to import the template into a newly created group:

set quarterLabel to "2022Q4"
set weekLabel to "2022W48"
<...>
set weekGroup to create record with  {name:weekLabel, type:group} in quarterGroup
import _pathName name "Weekly Results.html" to weekGroup
<...>

The above code works just fine and the Weekly Results file appears in the correct location.

The next thing I’m trying to do is to alter the weekLabel within the Weekly Results.html record. For that I need the record. So when I change the script to store the results of the import in variable weekly, applescript refuses to compile with an ‘access denied’ error

<...>
set weekly to import _pathName name "Weekly Results.html" to weekGroup
<...>

Does not compile. The exact error message is:

Syntax Error

Can’t set «constant Rmdsrds4» to «event DTpacd01» _pathName given name:“Weekly Results.html”, «class DTto»:weekGroup. Access not allowed.

DEVONthink 3 has full disk access and automations enabled.

Any suggestions on how I can replace text in the newly created record?

Perhaps the record you try to access is not created yet?

The error happens during script editing, not execution.

Not seeing an issue here…

What is _pathName ?

Thanks for this, and apologies for the time wasted - apparently “weekly” is a reserved word.

1 Like

Ah, the fun of AppleScript error messages …

Ahh… that makes sense. I was wondering why you were getting «constant Rmdsrds4» in the error.