Changes in external smart rule scripts not detected?

I am a newbie to DEVONthink automation, and I’m working on a couple of scripts for use in smart rules.

It looks like changes in external scripts used in smart rules aren’t detected. I’m assuming from a couple of old threads here that this is because the compiled scripts are being cached. Unfortunately I can’t find a way to cause a change in the script to be detected, short of restarting DEVONthink every time.

As I say, there is a very old thread here (Anyone using attached scripts?) that says that this also used to be the case for the scripts that can be invoked from DEVONthink’s script menu. There was at one time an option to discard the cache, but that was removed (in 2013?) because it was no longer necessary. Indeed, I observe that if I just save a new version of a script under the Menu directory, invoking it again gives me the new version. That’s a lot easier to work with.

Is the difference in behaviour between menu scripts and smart rule scripts intentional? If so, how do people develop scripts for use in smart rules? Other than restarting DEVONthink, the only way I have found has been to use the “Embedded” option in the smart rule, but that’s obviously still a lot of steps to go through for every change. Given that most of my attempts fail horribly because I don’t know AppleScript well enough yet, I’m hoping there’s something I can do to simplify things.

(I had written the above before noticing that External scripts with Smart Rules: when does DEVONthink reload them? mentions the same issue. I’ve created this as a separate topic because I can’t see a way to add the “Automation” tag to an old thread. Apologies for the duplication.)

1 Like

You can test Smart Rule scripts with this line

tell application id "DNtp" to my performSmartRule(selection as list)

I put that in an on run block at the end of my script and it seems to work fine. Doesn’t let me work with rules that have a lot of steps, but it’s a good start.

Thanks for the tip!