Is it possible to group Smart Rules in the sidebar?

Hi,

This might be clearly described somewhere and I just can’t find it. I apologize in advance if that is the case.

I have started to use smart rules to organize my databases and it works very good. However, I’m starting to have a lot of rules and it would be great if the rules could be grouped and collapsed. That way it would be easier to find and modify the rules that I have. Is this possible?

Best regards,
Björn

2 Likes

Not yet but soon:

18 Likes

Great! I’m really looking forward to your next “integer” release!
Best regards,
Björn

1 Like

Another question about organization of a larger number of rules. Will it be possible to search for them? Or will it be possible to have annotation files, that can be searched, linked to rules or groups of rules?

Searching might be added to a future release. How many rules do you actually use currently?

Do I have to count how many? :joy: Too many (50+)…

I like to organize into groups by website. Therefore I have many rules like this:
If URL matches “website”, move to group and then rename “name”+“sortable creation name”.

It would be good for me if I could have one rule per database with

  • many conditions of the type: If URL matches “website”,
  • then move to group named “matched website” and then rename “name”+“sortable creation name”.

I suspect that this is doable using some scripts but I don’t really know any scripting language.

Screenshots of two such rules would be great. Maybe it’s possible to handle this in one rule.

Here are two rules.


I’d use a single rule and a script instead. Easier to manage.

Yes, I understand that this is probably the best way in the long run. However, as I said, I don’t know scripting all that well. Do you have a good pointer where to learn scripting of DT?

The forum provides many examples. Most of them are written in AppleScript, which I would not encourage to learn – it has no usage outside macOS and lacks plenty of modern concepts like regular expressions, string handling, array methods etc. Instead, I’d encourage using JavaScript, which is available on all current platforms and used in many places, notably web pages. I provide a website that explains the usage of JavaScript for scripting macOS apps. It does not, however, teach the language itself. But the web is full of sources for that.

The preference of JavaScript is a personal opinion, others opt for AppleScript citing a perceived ease of learning There are also sources to learn that online, though I have the impressions that most of them are pretty dated.

The basic idea of a script would be

  • define a mapping of URLs to database/group
  • for each record
    • append the sortable creation date to its name
    • move the record to the database/group as determined by the mapping defined at the start

Something like that, which is not tested

const mapping = {
  "skepticalinquirer": {database: "database1", group: "skepticalinquirer"},
  "skeptical.com": {database: "database2", group: "skeptical.com",}
}
const app = Application("DEVONthink 3");
function performsmartrule(records) {
  records.forEach(r => {
    const creationDate = r.creationDate().toISOstring().replace(/T.*/,'');
    r.name = `${r.name()} - ${creationDate}`;
    const target = mapping[r.url()];
    if (target) {
      const group = app.createLocation(target.group, {in: target.database});
      app.move({record: r, to: group});
    }
  })
}
5 Likes

Thank you very much! I see that this method has potential :nerd_face:

hi Christian, has this been implemented in 4 beta? tx!

Yes, that’s available in the beta.

1 Like

Windows > Sidebar: Navigate

1 Like

Tx Jim, I was looking at the Smart Rules section itself, didn’t find it - forgot to check the Sidebar section.

Lovely!! much appreciated!

2 Likes