I am struggling with an AppleScript that adds or updates a folder in DTPO, triggered by Hazel.
set thePath to POSIX path of theFile
and a subsequent
exists record with path thePath
But a subsequent
get record at thePath
gives “missing value”. I don’t understand why this fails.
I 'd be grateful if somebody has and idea what’s wrong here.
You are confusing path and location. These are two distinct properties. (Note: The location is a POSIX styled path, not a POSIX path.)
So your variable holds a path, not a location. You need to get the location of a record in order to use get record at.
I really wish that there were a proper documentation of DevonThink’s AppleScript features that would explain such details. E.g “get record at text” says “The location of the record as a POSIX path”. How is one supposed to deduce from this that location and path are two different things?
So, again using the Library documentation, I tried to get from path to record with
set theRecordList to lookup records with path thePath
repeat with theRecord in theRecordList
But now I get an error about missing parameters from synchronize.
I’d really be grateful for some information/pointer on how this is supposed to work.
“synchronize record theRecord” should work.
Sometimes by trial and error or brute force. Remember that documentation is written by people. I have been professionally scripting for almost 20 years and I guarantee you, there are discrepancies in the dictionaries of most every app, even Quark, Apple, and especially Adobe.