58: Opening files with Hazel

I've been trying to expand my use of Hazel since version 4 was released last month. I haven't come up with any revolutionary new rules, but I have come to appreciate some of the biggest time savings from rules I already had in place.

Since Hazel acts on files and folders, I think the common conception is that it does filing tasks for you: clearing off your desktop, sorting PDFs of utility bills, or getting truly obsessive about your pirated video collection. That's all very useful, but can be done with only the rename and move actions — just two of many available in Hazel. I've found that one of the most convenient, lesser-used Hazel actions is to open a file. Of course, you have to put some tight controls on what Hazel will open and when. (I've messed up the logic and had a rule run rampant, opening dozens of windows until I killed the Hazel helper process; pause the folder and preview your rules, kids.)

Here a couple of my use cases for auto-opening:

Reviewing downloaded files

Some people like every file that lands in their Downloads folder to automatically open. I find that to be too obtrusive (and it's half a second away in LaunchBar: ⌘-Space, D L, ⌘-Right Arrow, Enter). But it's a good example of the limiting logic necessary for rules that open files. For every file, the Finder and Spotlight keep track of not only Date Created and Date Modified but Date Added — this is how your Downloads folder is sorted by default. Hazel itself keeps track of another parameter, Date Last Matched: when Hazel most recently took a peek at the file's metadata. A rule that triggers on "Date Added is after Date Last Matched" will perform an action just once when a file is added to a folder.

My rule that opens downloaded files actually doesn't use this logic, since it only matches very specific files: work that I've just submitted to an online system and I'm downloading a local archive copy of. That's triggered by my initials and a specific tag in the content of the file. But I need to do a visual check to make sure the file uploaded accurately. So, after Hazel does its typical filing, it opens the document.

Podcast processing

You might have guessed that I use Hazel in the production of Picomac. I use it to strip out GarageBand's timestamp in the filename, move the file to a dedicated "episodes" folder, and then open it in VLC, where I can check the audio and add metadata.

The extra Date Added condition is a safeguard in case Hazel loses track of the true Date Last Checked.

For the first 20 or so updates, I did that all manually, and it was error-prone. Files wound up in the wrong folders, improperly named, or — the worst — accidentally opening in iTunes. Now the process is always accurate and I save almost a minute of busy work; that's Hazel, opening files and doing its job.