First, thanks for the help in getting started with Apple Script! This is something I’ve not much tinkered with before, and it’s always great to have a new tool in my kit.
Second, I went with a JavaScript bit of code to shut down and restart DT3, which works nicely. The code itself is as follows for anyone else who wants to use this procedure as I will:
(() => {
/* First, find and quit the app. */
console.log("About to close DEVONthink 3...");
var app = Application("DEVONthink 3");
app.quit();
/* Now wait a few seconds for it to close, then restart it. */
console.log("Waiting...");
delay(5.0);
console.log("About to restart DEVONthink 3...");
app = Application("DEVONthink 3");
app.activate();
})()
I saved this to a file named “RestartDT3.scpt” and can run this from the command line via:
osascript RestartDT3.scpt
And for the final bit of automation, I used the following command line to create a new crontab:
env EDITOR=vim crontab -e
Along with the following contents to execute the necessary command at 04:00 hrs. every morning:
0 4 * * * cd ~/ && osascript RestartDT3.scpt
We’ll see how this works when I’m next out of town. So far, it always takes longer than a day or so to stop responding, so I’m hoping this is the end of it.