Possible terminology clash with date specifier

This seems so basic I am embarassed to post the question, but here goes…

I imported into DevonThink (DT) some RTF items exported from Scrivener. Now I want to use AppleScript to set the meta data of the records in DT.

I parsed the original created and modified dates as text. They are formatted in a way that AppleScript understands and can coerce to a date object, which I assume is necessary to set these values in the DT records.

In a test script with no tell block, this compiles and runs:

set dateString to "December 13, 2020 at 3:36 PM"
return date dateString

But within a tell block for DT, I get a compile error:

set createdDateObj to date createdDateString

Syntax Error: Expected end of line, etc. but found identifier.

and Script Editor has highlighted the createdDateString string.

I noticed DT has a date term, so I suspected a clash. Is there a trivial syntax fix?

DEVONthink doesn’t support the date command in the way you’re trying to use it. You can put it in a handler outside DEVONthink or outside of its tell block.

Thanks for confirming. I know what to do now and it is trivial.

1 Like

If you’re posting code, please fence it with three backticks like so
code goes here
That allows for easy copy/pasting, syntax highlighting etc. And you do not have to manually bold-face the stuff. Alternatively, you can use the preformatted tag button at the top of the edit field (between the “quote” and the “upload” buttons).