Automate creation of Smart Rules

Hello

My workflow entails creation of distinct subject matter folders and a respective smart rule for sorting.

I currently have an automated process for creating the folders. Ideally I would like to augment that process to include the creation of a smart rule.

Is it possible to automate creation of smart rules by any means?

Thank you

If I understand what you are doing, would you be equally happy when DevonThink allowed nested Smart Groups?

Smart Group → search on a key term
– Sub-Smart Group → documents that are PDF
– Sub-Smart Group → additional search on term “homework”
– Sub-Smart Group → additional search on term “exams”


JJW

Not quite JJW.

What you’ve proposed sorts the matches of a key term into sub groups. (I used sorting in my post. Sending would be more accurate.)

The purpose of the smart rules (the creation of which I’m hoping to automate on the creation of a parent group) is to send documents (using tags) from the global inbox to an associated folder in another database.

My general use case is that I dump myriad files from various sources (emails, documents, notes etc) in my inbox. These files are related to distinct subject matters (for each of which I have an associated group & tag). I peruse my inbox and give each file a subject matter tag. My set of smart rules sift then recognize those files with their tag and send them to their respective folder.

When I create a new subject matter (currently using Shortcuts for this), a folder & tag are created simultaneously. It’s not possible to create smart rules using Shortcuts directly, but I’m looking for other ways I might accomplish this. At the very least I’d like to learn if automating the creation of smart rules is possible.

1 Like

I believe that you could always create an AppleScript that does what the Smart Rule would do. I realize this is a hack that you do not want.

It seems that the process you want to avoid is the need to duplicate a Smart Rule and change the settings manually in the new duplicate.


JJW

Sorry but no this is currently not possible.

When I create a new subject matter (currently using Shortcuts for this)

Are you referring to the Shortcuts in the macOS Monterey beta?

Isn’t it possible to create a report of type smart group and then set its properties accordingly? I seem to vaguely remember that I did something like this.
Can’t check right now since I’m away from my DT desktop.

vs

2 Likes

@Blanc is correct on this, and you were just slightly off in your recollection.

Local smart groups: Yes
Smart rules (which are global by design): No.

1 Like

Thanks for the reply Bluefrog.

I’m referring to Shortcuts on iOS but it’s clear what I ideally have in mind isn’t feasible.

I wonder if Smart Rules are stored anywhere in DT3 that’s accessible? Maybe a text file somewhere that stores them? Knowing that would help.

You’re welcome.
There is a plist file but it won’t yield anything immediately useful to you.

That’s too bad. I appreciate the help anyway @BLUEFROG .

Why don’t you use a script in one smart rule? A similar issue has been discussed here

In my opinion, having a bunch of smart rules doing basically the same is pointless (and difficult to maintain). Instead, a single rule (or a very small set) can use a single (or a small set) of scripts to distribute the documents to the corresponding groups/databases.

Also, you can write script that adds a new rule to the distributing script whenever a new subject is created. Which might be kind of tricky and will work only with external scripts. But still: It is feasible.

You’re welcome :slight_smile: