I’m creating a smart rule that performs a series of checks on incoming PDF files into the inbox and processes them accordingly. I’m writing a JXA script to do the processing.
One of the tasks is moving files to a group. I’ve reduced the TC to the following:
function performSmartRule(records) {
let app = Application('DEVONthink 3');
let group = app.createLocation('/Test', app.inbox);
records.forEach(function(record) {
app.logMessage('Record: ' + record.name());
app.move({record: record, to: group});
app.logMessage('Moved: ' + record.name());
});
}
When the smart rule is applied, the on performSmartRule (Error: Error: Can't convert types.)
error is logged. The offending line is the one with the app.move()
call.
Now the curious thing…
If I run the above as a standalone script (with osascript
) it works like a charm.
I’ve spent many-many hours already trying to figure out what could be wrong but sincerely I’m out of ideas. This here is my cry for help.
Thanks in advance!