Need Help With Rules to Maintain 1 File In A Certain Folder

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

So I have three folder that I use during different parts of my workflow. They are my "New Scans Folder" "Auto OCR Folder" and "Filing folder"

I use the "New Scans Folder" for the destination for all the new scan.

The "Auto OCR" Folder I want to use to hold one pdf at a time. I want to use hazel to open the 1 pdf in my OCR program that will auto run and then save over the original pdf. Then I want to use hazel again to move the file to the "Filing Folder"

The "Filing Folder" is set with tons of rules for naming and filing documents after OCR.

My Question is that I need help setting up a rule for Hazel that will monitor the "Auto OCR Folder" and maintain one pdf at a time. So that after the OCR is done on the pdf and moved into the "Filing Folder" that hazel moves a new one from "New Scans" to the "Auto OCR Folder".

Is this even possible. I sure hope so. If this doesn't make sense what I am trying to do I can try to explain it again.
Mr. Mohon
 
Posts: 8
Joined: Wed Apr 09, 2014 1:17 am

To do that, the Hazel rule on the New folder needs to check the status of the destination. That will require a script. Is there a reason to have to maintain that restriction? Is it an issue with the OCR program?
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

The restriction is because the OCR program that I am running is only able to do one file at a time. I am using hazel to open the file which triggers the OCR program to run and if there are multiple files then the program doesn't run properly.

Is it hard to write a script that could check the status of the destination?
Mr. Mohon
 
Posts: 8
Joined: Wed Apr 09, 2014 1:17 am

In that case, I don't think you need to limit one file in the folder. What you can do is just have the rules run over each file in the folder and OCR them. If it is feeding them too quickly, you can try adding a pause via a shellscript as follows:
Code: Select all
sleep 60

That will cause a pause for 60 seconds. You can tweak that value as needed.

Not totally foolproof but it is a bit simpler to implement. Doing a script to check the destination is not too bad either but you'll have to learn some scripting to do that.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you Mr_Noodle for your help. I am in the initial stages of trying to learn how to write script. I also might have a friend of a friend that could help with a script.

How complicated is a shell script to make?
Mr. Mohon
 
Posts: 8
Joined: Wed Apr 09, 2014 1:17 am

Depends on the shell you are using. By default, it's bash. It's a bit arcane but you can leverage a lot of the programs already on the system. Alternatively, you can use AppleScript which is more accessible.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion