DevonThink Smart Rule Date Matching

I’m new to DevonThink, and I’ve used Hazel for many years. One of my favorite features in Hazel is it’s ability to pattern match dates from a file name or from the OCR content and then serve back the date in a different format. My preferred naming convention is “2020-05-30 - Filename.ext” although sometimes I prefer “200530 - Filename.ext”. Right now, I have a folder full of downloaded bank statements that came with the name formatted as: “statement-May-2020.pdf”. Is there a way for a smart rule to extract “May” and “2020” and use those as variables in my preferred format?

I’m sure there’s an AppleScript solution, but maybe there’s something built in to the Smart Rule editor that I’m not getting? I’m not finding much documentation on Smart Rules.

Thanks!

No, you cannot convert values like that in a smart rule. You could try a scan text to look at dates in the contents instead.

Currently only by using an embedded & customized script.

@jbhutt

Since you use Hazel, I’ve found that the quickest way is to export to a finder folder, run a Hazel rule, and reimport to DT. Or if the files are indexed to DT, just run Hazel on the finder folder.

If you are doing this routinely, say monthly, and are comfortable with scripting, a script in a smart rule would be the way to go, in my opinion.

Thanks!

I have relied on Hazel for so many years, sometimes I forget it’s there. Of all the ways to import files to DevonThink, I have considered adding a “Devonthink Import” folder so I can have Hazel do some renaming, if applicable, then send to DT, then dump the file. But if I can accomplish the same end from within DT by getting better at scripting, that’s what I should do.

(But I also realize that Hazel is amazing, and it’s foolish to think I can do it as well!)

Thanks, Bluefrog!
I did find the documentation in the help that you indicate above, but I couldn’t connect all of the dots. Still finding my way around DT.

No worries. There’s a ton of power in DEVONthink. Not necessary for everything, but there if you need it.