Smart rule "on import"

i sure im doing something wrong and looked at this thread Smart rule on importing

but i cant get DEVONthink to launch a smart rule on when the file is “imported” unless im not getting what import is

i have this in my smart rule

which to my understanding should launch each time a video is sent to my DEVONthink inbox

yet the smart rule never launces (here is the full rule) even though it does match

any clue? is importing something else?

thx a bunch

Z

It’s an On Creation event.

How exactly do you “import” the videos?

hi both

i move the video to the inbox group in DEVONthink via a finder folder action setup

thx!

Z

Folder actions and scripting don’t trigger smart rules. You potentially could add a perform smart rule command to the folder action script.

thx so much

would i need to manually edit the applescript? i dont see this in the DEVONthink scripts

my current approach is to have the smart rule run every 1 minute..if i have a bunch of these are they to taxing on the system:

You’re not adding a new script. You’d select it in the Folder Actions Setup window and press the Edit Script button.
An edit would look something like this…

tell application id "DNtp"
	set theRecord to import path thePath to incoming group
	perform smart rule name "Beep" record theRecord
	if exists theRecord then tell application "Finder" to delete theItem
end tell

Running a smart rule every minute should only be used in very specific circumstances, not for general use. Imagine you are waiting for a parcel in the mail. Would you run and throw open the front door every minute, just in case it was delivered in the 30 seconds since you walked away? While you could, I think you’d agree it’s inefficient and wasting energy.

@BLUEFROG awesome this would be super useful for many things!

Last question, this works well (just tested) for my video files, yet since i ditched hazel and use DEVONthink for all my capture and automations, i put many other file types (pdf, images, md etc) in my capture folder (DTimp).

Should i have a separate folder action/script for each filetype i want to import and run a smart rule, or should that all be in the same script and launch a smart rule based on the file type (ie have the applescript identify the filetype and run the smart rule)?

Thanks so much

Itai

You’re welcome.

I can’t answer this specifically for you but either option is potentially viable. Personally, I would set things up separately so I could debug and polish the process for a few file types. Then I’d live with it for a bit and see how it feels. I would then assess the setup later and decide if combining them is worth it.

Claude could probably easily refactor separate scripts into one combined script :slight_smile:

Perhaps a passable one, but I could do a better job of it :wink:

1 Like

Hi @BLUEFROG and all

im circling back to this as i have allocated some time today to try and advance with this :slight_smile:

based on the previous posts i can start creating separate folder action scripts per each import i do (bills, insurance, work, life, fuel etc) so that each import immediately launches a smart rule in real time but i want to confirm first:

@BLUEFROG reading your post again here Smart rule on importing - #4 by BLUEFROG
you seem to suggest its better not use the folder action method but just index my import finder folder into my database?

is that still the way you recommend fin DEVONthink 4?

if thats the case, how do i account for the indexing of external folders? do i need to have a script that reindexes often?

thx alot

Z

is that still the way you recommend fin DEVONthink 4?

While there still can be uses cases for folder actions, by and large indexing a folder and using a smart rule is generally advocated.

if thats the case, how do i account for the indexing of external folders? do i need to have a script that reindexes often?

DEVONthink should receive notifications of changes to indexed folders and act when notified.

Here is a smart rule targeting an indexed group that moves PDFs into a PDFs group in DEVONthink…

thx alot @BLUEFROG i tried it and seems to work

yet when it executres as opposed to the finder folder action import&delete the move methond in my smart rule seems to leave a copy in the finder folder:

here is the current smart rule:

i assumed move means move (ie cut and paste) the file from the indexed folder to the final DEVONthink group destination?

thx

Z

Look at my example smart rule again.

thx @BLUEFROG !

yes i missed the move/move to database!

i still cant get it to work, i setup everything correctly it think but DEVONthink does not seem to respond to new files in the action folder.
im created a short video to better show the entire process:

as always really appreciate the help, would love to get this up and running finally!

Z

Have you chosen a cloud-synced folder? DefaultFolderX makes things look odd. It is well-known and documented such folders don’t always reliably provide notifications about filesystem changes and often require using File > Update Indexed Items when the indexed group is selected.

Also, your video shows you adding a new folder as an indexed group but there’s nothing showing you’ve adjusted the smart rule to target that group?

ha! indeed, it was the cloud synced folder!

i set it up years and years ago as my catchment folder, i completely forget about that fact it was symlinked :slight_smile:

i guess i can still make use of hazel to push stuff from a cloud folder for ios capture to my new local DEVONthink folder :slight_smile:

as always @BLUEFROG save the day! :slight_smile:

Z

1 Like

You might run into trouble if your cloud service does weird things with this folder (like “optimizing” space, which iCloud pretends to do).

And the issue here is not so much that it’s a symlink, but that your cloud service probably does not send the same file system events macOS does.

The alternative to pushing things from here to there passing through a third location might be to update your indexed folder regularly. This could perhaps be achieved by a smart rule running every hour or so and executing a synchronize command for the folder.

1 Like