Smart Rule on a group doesn't trigger

Hi,
I have a group in which I have a set of pdfs to be reviewed by me. I highlight portions of the pdf , then run an AppleScript which generates a markdown of the highlights, copies the md file to Obsidian and then moves the PDF to another Group. I have a smart rule on this group which goes like this -

Now , interestingly the smart rule doesn’t get triggered when the PDF is moved into the group by the script. However, if I move the PDF to another location and move it back, the smart rule gets triggered.

What am I doing wrong ?

The On Moving Into Database action is used to import indexed items (something we call “consolidating”) into a database.

You’d want to use an On Moving action targeting the group receiving the PDF.

I’m moving the PDF file from one DB to another . I changed the condition to “On Moving” from “on moving into database” - same result. The smart rule is not triggered

I also don’t understand why the smart rule is triggered when I manually move the PDFs into the DB but not when moved by an AppleScript

I seem to remember that scripts don’t trigger actions in general. @cgrunenberg would know for sure.

Scripts don’t trigger smart rules IIRC; this is to avoid infinite loops and other unexpected behaviour. The script can activate the on move trigger for the item if you add the following line, though: perform smart rule trigger move event record theRecord (assuming theRecord is the variable you have chosen for the item in your script).

Edit: I think that currently won’t work; perform smart rule won’t run from within a “performSmartRule” script handle; again, if I understand the mechanics correctly, this will be changed in the next release.

Edit of the Edit: whilst the dictionary still says “NOTE: This can’t be used in “performSmartRule” script handlers of smart rules.”, the change in behaviour was implemented in DT 3.8.4, so actually it should work (@cgrunenberg is the dictionary in need of update?)

The description is indeed outdated, just fixed this. Thanks!

1 Like