Smart Rule only executing on PDFs with Finder Comments

I’m trying to create a Smart Rule that executes “On Open” with PDF/PS files:

2022-02-23 CleanShot CleanShot 18.28.52

The weird thing is: this rule only triggers when a PDF file has Finder comments. It doesn’t trigger when Finder comments are absent. The PDF files without Finder comments do show up in the Smart Rule, so it doesn’t seem to be a selection problem. Any idea why it is only triggering on PDFs with Finder comments?

(If it’s relevant: this is on an indexed folder with PDFs)

I’m not seeing it trigger with or without Finder Comments.
Neither the On Open or On Open Externally event triggers seem to be working on macOS Catalina.

Can anyone else confirm?

PS: On Open doesn’t necessarily mean opening in a document window. Open is also reading the file, i.e., displaying it in the view/edit pane.

Here’s an example of the behavior on macOS Monterey, where the event triggers are working…

Thanks for checking this. It would great if others could confirm too this isn’t working as inteded. I’m on Monterey and DT 3.8.2 btw.

The Display Alert message is empty, is this intentional?

Yes that was intentional. Also doesn’t work with other actions

An alert requires a message.

In practice it works fine without a message. I’ve tried with and without a message seeing the same behavior.

So far I couldn’t reproduce this but I’m using the latest internal build (although this shouldn’t make a difference).

I’ve recorded a .gif to show what’s happening (on Monterey running DT3.8.2) - notice how the alert only shows when Finder comments are present (using the Smart Rule posted above in this thread)

2022-02-25 DEVONthink 3 Open annotation in Obsidian — forum.keyboardmaestro.com - HTML Prompt Functional with Style HELP - Questions & Suggestions - Keyboard Maestro Discourse.pdf 12.08.48

This is a question which potentially insults your intelligence - it is not meant that way. From the screencast (thanks for that, btw) I cannot verify that the items you are looking at are actually all pdfs. I see the ending, but cannot be sure that it is not part of the file name (so xyzzy.pdf vs xyzzy.pdf.pdf). So whilst I’m sure this is going to be a useless point: are all the records in question pdfs? Have you tried the rule with “Kind is any document” just for the sake of trying?

I have tried to recreate what you are seeing, but have failed; using macOS 12.2.1, DT 3.8.2, Intel Mac, indexed folder, both PDF + Text and PDF trigger the rule reliably.

Have you tried placing the rule at the very top of the list of rules to be sure that another rule with a Cancel action isn’t causing the trouble?

1 Like

I’m not insulted in any way @Blanc - appreciated you thinking along :slight_smile: It’s actually a good tip. All the documents in the screencast are actually PDF (I was browsing the view from the smart rule itself. But something else I found out based on your comment. When changing the Smart Rule to “Any Kind” it does trigger on every .md file and on the .pdf files with Finder comments. But still not on the .pdf files without Finder comments. It seems like some kind of bug, but not yet sure what the bug is.

Updated screencast:
2022-02-25 DEVONthink 3 Open annotation in Obsidian — discourse.devontechnologies.com - Annotation Pane (Annotation with Links Notes Tags v3) - DEVONthink _ Automation - DEVONtechnologies Community.md 13.03.31

I missed the last part of your comment @Blanc: reordering the Smart Rules. That did the trick! I had another smart rule that indeed had a Cancel action and also applied (actually to files that had a URL field). I didn’t realize that Smart Rules all ‘worked together’. Thanks for pointing this out and helping me ‘fix’ this (which is obviously not a bug, but rather an oversight on my side)!

3 Likes

You’re most welcome. Smart rules run sequentially from top to bottom; any smart rule which is triggered and has a cancel action will prohibit any further rules (i.e. those further down the list) from triggering for that individual trigger.

Yes, that I should have seen - thanks for working with me :slight_smile:
(Ah, no, it wasn’t visible in the first screencast, I’ll let myself off the hook :D)

1 Like

Again. I learnt that some weeks ago, it irritated me then and it irritates me again. In my limited mind, “cancel” means “stop what I’m doing now”, not “stop what someone else might be doing later”. Like I click the “cancel” button in a dialog and the file is not deleted. Kind of related directly to what I’m seeing: “Cancel” this flight, not the one leaving two hours later with the same destination.

In DT (and I know that this is intended) however, cancel refers to something that I’m not seeing. I’d therefore suggest to change the wording to something like “Stop processing matches”. Or any text that makes it immediately clear, what is cancelled.

Even if the name stays as it is, it should clearly be explained in the documentation. I was looking for “cancel” in the “Actions” list for smart rules and didn’t find it there (or is it @BLUEFROG ?).

Also, “Cancel” is the default action for any newly created smart rule. Is that really a good choice? Hazel, for example, has an action called “Ignore” that does exactly nothing (as is to be expected). Having that as the default action for newly created rules would prevent side-effects.

Frankly, going on a wild goose chase like this through 14 posts shouldn’t be necessary. And I’m not so sure that the behaviour of “cancel” as it stands now is really a good idea. If I understand the situation correctly, @mdbraber has one rule to work on records with an URL defined and a completely unrelated other rule to work on PDF records. Now the “cancel” in the first rule stops the second one from firing for all PDFs that have an URL … From an unsuspecting user’s view, that really might come as a surprise. Aside: Hazel does not have this automatic chaining of rules (so rule order does not even exist there), but a “Continue matching” action that explicitly passes on records matched by the current rule to other rules. I’m wondering if this might be a better approach (given the rule of least surprise).

1 Like

Cancel is not documented. I will add it to the documentation for the next release.

1 Like

Speaking as someone who’s been confused by the meaning of the “Cancel” action myself, I want to voice my agreement about all this.

IMHO, it really would be helpful to rename “Cancel” to something that makes it more obvious the action stops subsequent rules from executing. As to “Cancel” being the default for new smart rules, @chrillek’s suggestion of adding a new action, “Ignore”, is a great idea. Alternatively, if the developers want to avoid that, then perhaps a minimum-cost solution would be to change the default from “Cancel” to the “Mark” action, or something else that’s innocuous.

The next release will rename the action and it won’t be the first/default one anymore. Is the name used by Apple Mail (“Stop evaluating rules”) better?

2 Likes

Yes, by far

Yes, I believe this would be better.