(() => {
'use strict';
const app = Application("DEVONthink 3")
// Assuming the existence of a record with id 40291
// in the first database.
// String
return app.databases.at(0).records.byId(40291).name();
})();
I apologise if I was too terse in my post.
The original problem was that an addition assignment like this failed;
r.plainText += " append"
I wanted to use this to append to the plaintext property of a record.
The simple assignment r.plainText = "text" works, so I’d expect the addition assignment += to work, too.
Which it doesn’t. I’m aware that r.name(), r.plainText() etc return the current value of the property. Which indicates that these properties are in fact functions. But if I assign a value to these properties, I do obviously not change a function but set the value its next call returns.
So on the left side of an assignment, name, plainText etc behave like a scalar. As long as one doesn’t try to use a particular assignment operator.
That’s right – the writable property and the get method share a name.
( Incidentally my own experience is that the amount of time lost in debugging shrinks suddenly as soon as we abandon mutable variables and work only with constants – so I personally never reach for mutation operators like +=, but that is another story : -)