Smart Rule to open the document on the last Sunday of the month

I’m trying to create a Smart Rule which, when a matching document (a credit card statement) is imported, will automatically add a reminder to it that opens the document externally at 10:00 on the last Sunday of the month in which the document was imported.

I have no idea how to get AppleScript to do this date calculation. I can do it in JavaScript, but from what I’m reading, JavaScript is not supported in Smart Rules despite there being an option to select it under Execute Script :confused:

Does anybody have any hints on how to write an AppleScript which performs this date calculation and sets the reminder? Thanks!

which performs this date calculation

which date calculation?

What’s the incoming date to process - the Date Added?

That’s right — if I add something in March 2022, I would want the reminder to fire on Sunday March 27 (or the last day of the month if it’s added on or after that day, I guess…)

What makes you think that? JS works mostly as well as AS (if not better, regarding date calculations, regular expressions etc) in DT’s smart rules. And I’ve already posted some examples here.

<PR stunt>
Other examples can be found here

</PR stunt>

1 Like

Hahaha! You’re shameless :wink: :stuck_out_tongue:

@Tiny_Clanger: @chrillek’s site is a good source of info indeed.

1 Like

Ah — I might have been looking at older threads and not paying attention to the dates! It looks like DT 3.8 fixed that. No wonder there’s a JavaScript option on the manu :man_facepalming:

Thanks for the link — I’ll have a look when I get back from holiday.

BTW, would it be possible for the script editor’s syntax highlighter to have some more readable colours for dark mode?


Which version of macOS & DEVONthink do you use?

This is with DEVONthink 3.8.3 on macOS 10.14.6 (the highest this Mac Pro will go to — I’ll check again once my Mac Studio arrives and I can run Monterey…)

I’ll check on my Mojave Mac later but Catalina is showing as…

Whoops — I thought I’d replied to this, but forgot to hit the actual button to send it.

I’ve since upgraded to a Mac Studio, and the colours are as you’ve posted.

However, that dark blue is almost illegible on my external monitors. Is there any chance it could be made lighter, please?

(Is there a way to increase the font size, too? On a 32" 4K display, the text is a bit small…)

There are no font controls for the embedded script editor.
Development would have to assess this and the color modification request.