Script for indexing files

I would like to set up a rule in Hazel ( that would run a script that indexes/imports the matching files from the folder monitored by Hazel into DTP database.

I figure the script for this could be written by using for example “Action Index” script (from DTP installer extras folder) as a base but I’m not yet able to make the needed modifications by myself.

Could anyone help me in writing this script?

I don’t think you need to write a script.

You can have Hazel monitor a folder for files with certain attributes, copy those files into a folder that DTP monitors and it will import those items into the database.

Hazel handles identifying specific file types and moves them into a target folder.
DPT handles the second part as it can index or import all files in a target folder.

Does this help?

Yes, I’m aware that I could do this but it’s not quite what I have in mind since I would like to leave the files to be indexed where they are rather than moving them to different location (these files are in fact pdf files of scientific articles organized by apps such as Papers and Sente).

But you’re right about that there’s no need to write a script. I happened to find out that Hazel can run a given automator workflow for files matching a rule, and it was pretty simple to create a workflow that indexes a file in a (predefined) database.

Anyway, thanks for your suggestion!

Sorry I misunderstood. Glad you got it solved.

Nifty things you can do with Hazel…