Borrowing a bit from the Add Selected Text to Comment script, I have the following AppleScript:
tell application id "DNtp"
set filePath to "/Users/ericg/Desktop/document.pdf"
set dp to import filePath to current group
set theWindow to think window 1
set dpUUID to uuid of dp
set cp to (get record with uuid dpUUID)
set comment of cp to "hello"
end tell
I do see the document appear in the DevonThink UI.
I am expecting the comment of the document I just imported to have its comment set to “hello”. Using Script Debugger, I can see the comment property being changed correctly.
However, in the DevonThink App, the comment is not updated.
In general, if you find that your AppleScript or JavaScript code does not do what you want, you should run it in Script Editor, activating the protocol (Cmd-3). Then check the events and the answers tabs.
The reason for the switch was that the simplified code wasn’t working, so I tried something else which also doesn’t work.
Doing:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application id "DNtp"
set filePath to "/Users/ericg/Desktop/document.pdf"
set dp to import filePath to current group
set comment of dp to "hello"
end tell
Does not work. The document shows up in the Application, but the comment property is not set.
I fell into the same rabbit hole, happy to find the answer here.
So the property “comment” will change the “finder comment”, not the “comment”.
What is the “comment” which is not the “finder comment” for?