I don’t know. The script does not crash DT here (although it also doesn’t write anything to the log window).
DT’s integration with JS is … a bit shaky. The jury’s still out to decide if that’s a problem of DT or something else. JavaScript in normal scripts works, mostly (although it is fairly easy to crash there with a three-liner, too). If you absolutely have to use a smart rule, than AppleScript is a safer bet.
@pete31: You’re right of course that smart rules don’t process the current selection. @Timetrinus’ code here makes sure that they can run the script in script editor: The bottom part is a self-executing function that uses the current selection to call performsmartrule
. While in the environment of a smart rule, the records
parameter would contain the records defined by the rule’s conditions, in the script editor one can pass the current selection as records
parameter.
hm, some new details:
DT don’t crashes but the script takes long time ± 10 mins and in this time I cannot use the application.
In console.log I get 2021-01-19 12:13:35.658 DEVONthink 3[2389:91535] ERROR: Error Domain=NSCocoaErrorDomain Code=256 “Die Datei „MailConduitVersion.plist“ konnte nicht geöffnet werden.” UserInfo={NSURL=https://devontech-downloads.s3.amazonaws.com/applicationsupport/post-install/mail/MailConduitVersion.plist}
When I now start the smartrule again, it comes directly back but nothing happens. When I end and start DT again and start the smartrule manually again I get the same situation: Waiting for 10 mins, no result but the error I in the Console.log.
Interestingly, this is totally unrelated to the script. Obviously. What does your smart rule look like?
Oh, and did you install DT3’s plugin for Apple Mail? And/or update it? The error message seems very clearly to point that way.
really strange: after now - for whatever reason - the sync of the DT3 database with iCloud has run (that should actually run always and automatically) As a result, my script in the smartrule now also works perfectly. I do not get it…
Were any activities shown in the Activity window or pane while the smart rule didn’t work?
no. nothing there.
Thanks a bunch!
Outstanding! Thank you