Hey fellow Hazelites. I've read through all the documentation but I cant figure out how to move a file to a different folder using the condition "the number of items in the destination folder is 0."
I'm trying to create a mac "robot" that runs macros when instructions are sent to it via email. The instructions are sent as .rtf file attachments. I want to create a drip-feed system for processing .rtf files that are emailed to my mac. I've setup my email to automatically download the attachments into my download folder. I've also set hazel to monitor the download folder for the incoming .rtf file (I have all of this working.)
Here's where I need help:
I want to setup Hazel to move the .rtf file from downloads folder to a folder called Queue. This folder will hold all incoming .rft files that the "robot" needs to process. Then, one by one, I want Hazel to move the "least recent .rtf file" from the Queue folder to another folder called Processing (this folder is monitored by my "robot" and instantly launches a macro using info from the .rtf file) ... BUT, I only want that to happen once the Processing folder has 0 files inside. The reason for this is because I don't want my "robot" to process more than one file at a time. So, the Processing folder is only for storing the file that is currently being processed by my "robot." Once the macro is finished processing, it deletes that file. As soon as the .rtf file is deleted, I want Hazel to move the next "least recent .rtf file" from Queue folder to the Processing folder, thus triggering the macro to restart again with the info from the next .rtf file. I hope this explanation makes sense.
Basically heres my ideal workflow:
1. Incoming email automatically downloads .rtf attachment into downloads folder. (I have this working.)
2. Hazel moves the file into folder called Queue. (I have this working.)
3. Once my "robot" has finished running its current .rtf file, the file is deleted from the Processing folder. (I have this working.)
//THE NEXT STEP IS WHERE I NEED HELP//
4. Once that Processing folder has 0 files inside, I want Hazel to move the "least recent .rtf file" from the Queue folder into the Processing folder. (I can't figure out how to run the rule for Queue folder based on a condition in the Processing folder (0 files in the folder.)
5. New file in Processing folder restarts macro. (I have this working.)
Thanks in advance for any help!
Aaron