The script to check the tags is pretty simple. Again, much liberty taken from Macdrifter’s excellent series of posts on this subject:
As Macdrifter pointed out, Hazel is expecting the script to exit normally or with error.
I setup a simple test script with a couple of tags, and an even simpler Hazel rule to watch the folder and look for files with matching tag and set the file color label.
Ok. Not great. The script works fine, but the Hazel integration seems flimsy. So time to rethink. It is possible to put automator scripts on folders, and have the automator scripts run anytime a file is added or modified. Maybe I could create a simple automator script to copy the tags to the spotlight comments, and have hazel use that information for judging the files. Better yet, a simple script as a Hazel action to update spotlight data with tags, then another Hazel rule to post based on spotlight comments. Or just a true false check using a bash script. I tried this:
It works fine from the command line, but not in Hazel. Similar to the challenges Macdrifter pointed out. I dropped a note to Hazel support to see if they could offer any advice.
The feedback I got from the Chief Noodler at NoodleSoft was to use full paths for applications called in the rule. So I changed the above to:
And it works perfectly! Nice and simple. Now it is just a matter of tying the two together. Once Hazel identifies a new file that has the correct tag, then call the script to post the file to blog.
It should work, but I’m going to give it a few days of testing and make sure I’ve worked out any bugs.
I also want to add in the post update options mentioned in the last post.