Quantcast
Channel: DEVONtechnologies Community - Latest posts
Viewing all articles
Browse latest Browse all 16217

JXA error with app.move()

$
0
0

Good that it works now. Not so good that you’re working around the whole idea of smart rules.

I’d suggest you have a look at the output of your original script again. What’s special about the record causing the error? As I said before: the original code runs just fine here. Which makes me doubt that it’s a DT issue (unless we’re using different versions – mine is 3.9.4).

Edit I just replicated your approach by saving the script in the Smart rules folder of DT’s script folder. Now I see the same error as you do:

03.02.24, 12:55:19: Number of records: 28
03.02.24, 12:55:19: Record: ScanPro 18.05.2020 18.12
03.02.24, 12:55:19: ~/Library/Application Scripts/com.devon-technologies.think3/Smart Rules/Copy to subgroup.scpt	
on performSmartRule (Error: Error: Typen können nicht konvertiert werden.)

@cgrunenberg: Shouldn’t external and internal scripts behave identically? Here’s the code:

function performsmartrule(records) { 
    let app = Application('DEVONthink 3');

    let group = app.createLocation('/Test', {in: app.inbox});

    app.logMessage('Number of records: ' + records.length);

    records.forEach(function(record) {
        app.logMessage('Record: ' + record.name());
        app.move({record: record, to: group});
        app.logMessage('Moved: ' + record.name());
    });
}

(Working on all documents in the global inbox that are of type “any document”).
If run as an internal JS script, it works ok. As an external script, it utters the first two log messages and then throws the error “Can’t convert types”.


Viewing all articles
Browse latest Browse all 16217

Trending Articles