Smart Rule not starting automatically

I have a Hazel script adding PDFs to DV3 using

set newRecord to (import theFile to destinationGroup)

I added this Smart Rule (see screenshot) but it is not executing automatically…
What am I missing?
Applying manually works…

AppleScripts don’t trigger as an On Import event.

What else are you doing with the Hazel rule or are you just using it to import into DEVONthink?

Renaming the file with the correct name depending on the content and assigning several tags depending…

I got it to work with other triggers, like synchronisation, etc.
Do not know yet which one did the trick…

I’m curious about what you are doing as I also am using Hazel to help me load stuff into DEVONthink.

Your DEVONthink action trigger is “On Import”. What do you have Hazel doing that triggers the import of the file into DEVONthink? What is it that would trigger the “On Import” criterion?

Far as i know there is no specific action in Hazel that says “import into DEVONthink” (like it does for Photos, TV, and, and Music applications).

What I do with Hazel to have it help automatically move files into DEVONthink is make the final action in Hazel to move (or copy, depending on the situation) into the OSX folder recognised by DEVONthink as the “Global Inbox Folder”. For me this is in “~/Library/Application Support/Devonthink 3/Inbox”. Then in due course DEVONthink notices the new file then does the import. Like you I have various DEVONthink rules which use the “On Import” action to do things. This process always seems to work. Other triggers are not required as they are, seems to me, irrelevant.

Is your Hazel setup for it to present files to DEVONthink similarly?

You can use a script in Hazel to import directly from there into a DT group. That’s what I do for account statements after having renamed them in Hazel, for example, to move them to per-account groups.
I don’t quite get it why @selsrog does part of the work in Hazel and part of it in DT (too much complexity for my taste :wink: ) if all of it can be done in Hazel: rename first, move than. No need to set a tag in Hazel only to remove it in DT later on.

Yes, I can see how a script called from and inside Hazel can do it … but my brain tends to hurt if i get too many scripts involved!! I deliberately did not mention that and focused instead on built-in Hazel features. And yes, I don’t quite get why @selsrog is doing all the renaming, tagging, etc…

Hi Guys,

Thanks for the replies and apologies for the hurting. :wink:

I have roughly 200+ existing Hazel rules which used to tag and rename files before adding them to Evernote.
Why so much rules? It recognizes each of my invoices (in and out) by name (among other things). And I have a lot of them… as the name of invoice issuer cannot be found automatically

I am currently in the process of migrating to DT3, and I’m discovering functionality while doing it. So bear with me as I might do things rather strange…

One of the things Hazel does for me, is finding the invoice date, which I add to the name. Sometimes Hazel does not find it automatically. The second invoice I migrated to DT3 had that issue.
So I played around with DT3s date detection in Smart Rule. Lo and behold, it did find it… So that’s where the hurting started. Doing parts in Hazel and parts in DT3.

Having over 100+ Smart Rules In DT3 also seems rather inconvenient to me from a user interface perspective. Hence the combination.

PS: @rmschne, the Inbox solution seems a solution for the rules triggering (I add the note via AppleScript, see the fist post above). Thanks for the tip.

I do all the date finding (and resulting logical file renaming with the date, entity, etc.) all in Hazel, which then presents the file to the DEVONthink Global Inbox. I never did a check to see which is better. I found when Hazel didn’t work as expected, it was “self-inflicted” bug. Again, to keep things simple I would probably do all the complicated file stuff in Hazel and reserve DEVONthink’s automation to DEVONthink-orientated things. I don’t do any tagging except by hand (occasionally). I used to. Then I noticed in DEVONthink I never used the tags. Groups and searching (especially for things like invoices and financial transaction stuff that once in never hardly looked at, but there “just in case”). For me, tags are one of those “wouldn’t it be a good idea if …” that didn’t provide any added value to me. Some people love 'em. No Apple Scripts (or Python) involved.

Just how I do it. Your mileage may be different.

In my case, there’s only one Hazel script :wink: it determines the database and group in DT by matching the filenames (or tag) which have been set by a Hazel rule beforehand. But I see your point. That’s why I moved the whole sorting logic into a single script.
And I do most of my sorting etc still manually. Hazel comes into play only for documents that are at least monthly - account statements, telecom bills. The rest is too varied to merit automation.

Scripts don’t trigger events by default (as it’s unclear which action should actually trigger which event and when exactly) but this can be added via the perform smart rule command. E.g. the scripts for Mail already do this.

1 Like