Yes, that’s the “depressing” part of trying to figure what’s going on.
I’ve adapted it so you can run it directly:
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());
});
}
// Set to false to run as a smart rule
if (true) {
let app = Application('DEVONthink 3');
// Get all records in the inbox
let records = app.inbox().root().children().filter(function(record) {
return record.kind() != 'Group';
});
performsmartrule(records);
}
Ive just confirmed that it works when running with osascript -l JavaScript script.jxa
but not inside DT as a smart rule.
Thanks for the help.