Rule to be executed only once an hour on only one file

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I can't get it to work...
I want to create a rule which is executed only once approximately every hour on one file. Then stops and processes the next file one hour after processing the last file and so on.

I thought I could do that with an automator workflow creating a text file within the same folder called something like "temp_import_calibre_hegel.txt" every time the rule is executed and tell Hazel not to process if it finds this file within the folder. Then having another rule to delete the text file after one hour, so that the first rule will be executed again.

Now I can create the "temp_import_calibre_hegel.txt"-file without a problem, but can't tell hazel not to process if she finds the "temp_import_calibre_hegel.txt"-file within the same folder.

I thought that would work with a nested condition: "If none of the following conditions are met for any file or folder in the same folder" ➔ Name is temp_import_calibre_hegel
Image

Image
Where the "Run Automator Workflow" creates the text file "temp_import_calibre_hegel.txt"

But the rule gets executed nonetheless...
I tried several conditions as "Name contains", "Extension is .txt", "Full name" etc. but it does not seem to work.
Does someone has an idea how to solve that? :?:

Thank You for all Ideas!!
Last edited by Robert on Sun Jan 06, 2019 5:13 pm, edited 1 time in total.
"Behind all the inhuman aspects of automation (...) its real possibilities appear: the genesis of a technological world in which man can finally withdraw from (...) the apparatus of his labor – in order to experiment freely with it." /Marcuse
Robert
 
Posts: 27
Joined: Sun Dec 16, 2018 8:05 am

Your image didn't show up. It appears to be some sort of Dropbox link, and Dropbox doesn't play well being used as an "embed" link on other sites.
luomat
 
Posts: 11
Joined: Wed Mar 10, 2010 3:57 pm

its shown to me.. strange.. I added a second picture. Does that one work?
"Behind all the inhuman aspects of automation (...) its real possibilities appear: the genesis of a technological world in which man can finally withdraw from (...) the apparatus of his labor – in order to experiment freely with it." /Marcuse
Robert
 
Posts: 27
Joined: Sun Dec 16, 2018 8:05 am

You can try something like "Date last matched not in the last 1 hour" to process something once per hour. That said, I'm unclear when you want the next file processed. If you want it done an hour after the preceding file, you will need more complex logic. Also, note that the order in which files are processed is not something you can rely on.
Mr_Noodle
Site Admin
 
Posts: 7633
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You can try something like "Date last matched not in the last 1 hour" to process something once per hour. That said, I'm unclear when you want the next file processed. If you want it done an hour after the preceding file, you will need more complex logic. Also, note that the order in which files are processed is not something you can rely on.


As I understood it the "Date Last matched is not in the last 1 hour" counts for every file. So If I have 2000 Files in a directory all files are processed, then Hazel waits one hour and processes them again. That is not what I want to achieve. I want Hazel to process one random File out of 20000 files in the directory, then wait a certain amount of time and then process again one random file out of the 1999 files of the directory, then wait again a certain amount of time... and so on.

(I am moving a huge database of PDF files with Hazel (Tagging, OCR, Splitting Pages, Converting if necessary etc.) – and I don't want to mess up so I have to recheck here and then the files moved and added. I don't have the time and nerv to do it all at once, and I need the directory the files go to intact and sorted with ready to use files, as I am continuously work with that directory. So I was thinking 10-15 files a day would be great to sort and add automatically so in the evening I can re-check them and see if everything went as it should...)
"Behind all the inhuman aspects of automation (...) its real possibilities appear: the genesis of a technological world in which man can finally withdraw from (...) the apparatus of his labor – in order to experiment freely with it." /Marcuse
Robert
 
Posts: 27
Joined: Sun Dec 16, 2018 8:05 am

You'll need a script to implement that sort of logic as it's not really something commonly done.

If you are nervous about the results, try it on a copy of the files or keep backups. That way you can verify it all at once without having to wait.
Mr_Noodle
Site Admin
 
Posts: 7633
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You'll need a script to implement that sort of logic as it's not really something commonly done.

If you are nervous about the results, try it on a copy of the files or keep backups. That way you can verify it all at once without having to wait.


Thank you Mr_Noodle! I will see if I can come up with a script and will post it here, if I find a solution. The problem is, that the final step of the process is importing the PDF into calibre and I have not found a way that calibre uses the right Author and Title so here I have to get active and insert the right name manually. And doing this for 2000 files at once is to much right now. But of course I can simply delete that last step in Hazel and do it manually at the end of my working day for 10+ files. I just thought maybe there was an easy solution...
"Behind all the inhuman aspects of automation (...) its real possibilities appear: the genesis of a technological world in which man can finally withdraw from (...) the apparatus of his labor – in order to experiment freely with it." /Marcuse
Robert
 
Posts: 27
Joined: Sun Dec 16, 2018 8:05 am

Not sure if it supports it, but look into using an AppleScript with Calibre.
Mr_Noodle
Site Admin
 
Posts: 7633
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support