# Using a single smart rule instead of Hazel (maybe)

**URL:** <https://discourse.devontechnologies.com/t/using-a-single-smart-rule-instead-of-hazel-maybe/67982>\
**Category:** Tips\
**Tags:** automation\
**Created:** [November 26, 2021, 3:06pm UTC](https://discourse.devontechnologies.com/t/using-a-single-smart-rule-instead-of-hazel-maybe/67982 "2021-11-26T15:06:04Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [November 26, 2021, 3:06pm UTC](https://discourse.devontechnologies.com/t/using-a-single-smart-rule-instead-of-hazel-maybe/67982/1 "2021-11-26T15:06:04Z")

</div>

Some people (me included) use a naming convention for their files and put them in certain goups depending on sender and/or content. I’m doing that for bank statements, some of the regularly arriving invoices and income statements.

In DT, you’d need one smart rule per target group, since it’s not possible to move a record to a group depending on some criteria. So if you have 5 bank accounts and two companies regularly sending you invoices, you’d need seven separate rules. Which is not good, because they do mostly the same thing: OCR the PDF if necessary, extract the relevant information (date, account no, sender, the like). So I decided to (Java)script the whole thing. You can read about it here

> **[Move PDFs into groups according to content - DEVONthink | JavaScript for...](https://bru6.de/jxa/automating-applications/devonthink/#move-pdfs-into-groups-according-to-content)**
>
> DEVONthink (DT) is a document management software with a companion app for i\*OS. It has a comprehensive scripting dictionary which makes it attractive and easy to automate. Most publicly available examples are in AppleScript, the following scripts...

and [download the script](https://bru6.de/jxa/automating-applications/devonthink/OCR%20and%20move%20to%20group%20for%20DT.js), As it stands, it will not run in your installation of DT: you’ll have to adjust the database and group names and of course the regular expressions to extract the date and so on. But it might be useful for someone – if only as a starting point.

---

_[View the full topic](https://discourse.devontechnologies.com/t/using-a-single-smart-rule-instead-of-hazel-maybe/67982)._
