Smart Rules: When does the 'weekly' action trigger?

Hi,

I want to run a smart rule once a week acting on documents modified during the previous week (using ‘last week’ as the criterion), but I’m not clear when exactly it would be triggered.

The definition of ‘this week’ seems to be connected to the first day of my calendar (which happens to be Monday), but can I assume that the ‘weekly’ trigger will fire at 00:01 hours or there about every Monday? (Or whenever the Mac next wakes up?)

Thanks!

There’s actually no fixed time or day, weekly triggers every 7*24 hours (assuming that the computer is always on).

Ah, so I can’t even assume it will trigger every Monday, because the 7*24h period may have started on another day?

OK, thanks for the quick response!

No, that’s not possible; it will be triggered as soon as at least 7 × 24 hours have passed.

OK… it’s not important enough (for me) to try to find a workaround in AppleScript, though I assume it’s possible.

Thanks again for your quick response…

You might consider a reminder instead.

But that doesn’t give me an easy way to trigger the Smart Rule, does it? I suppose I’d have to write an AppleScript to do that – I’ll look into it when I have more time.

Thanks again…

Reminders can execute scripts which could perform smart rules :wink: But depending on the desired task the smart rule might not even be necessary, e.g. scripts can search on their own and process the results just like smart rules do.

2 Likes

That was the complexity I was originally trying to avoid… I’ll have a look at when I have more time as it’s not an urgent requirement.

You can set up everything in the smart rule itself (scope, actions) and use a simple reminder script that is just a trigger.

Create whatever document; you just need something to add a reminder to. Maybe a text file explaining the purpose of the smart rule plus an item link to it. Open Inspectors > Info > Annotations & Reminders. Add a weekly reminder and select the alarm Execute JavaScript/AppleScript.

Click the ... button to edit the script. Here is a simple JavaScript. Just add the name of your smart rule:

function performreminder(record) {
	var app = Application("DEVONthink");
	app.includeStandardAdditions = true;
	app.performSmartRule({
		name: "My Amazing Smart Rule"
	});
}

For a little more detail, here is performSmartRule in the scripting dictionary:

2 Likes

Thank you – that is really helpful!