Rules is an old time feature in OS X. It can be found all across the Cocoa app — commonly in Finder, Mail, and iTunes. Setting up rules for your favorite apps is straightforward. Natural language takes away the fear of making mistakes during the setup. Once the rules are set, we have what we call as smart folders, smart playlists, and smart mailboxes.

You probably have never heard about rules before. Why should you learn about it? What are the advantages of rules? Obviously, I’ve seen some people who don’t organize their folders and leave smart folders filtering files for them. But, when you use productivity app such as Hazel, then rules is one of the important tools you need to know.

Sometimes we only want to see all the files that have been created today. Let’s try this with smart folders in Finder. We’ll create a smart folder1 which only display all files created today.

These rules, as shown above, are the common one. They’re simple. As you become more experienced with rules, you can create many smart playlists to generate songs automatically every day in iTunes. All can be done without you lifting a finger.

But that’s not the only thing. These rules can be nested. Nested rules is useful when you’re faced with some problems that doesn’t seem resolvable.

Let’s start with a simple problem. What if you want a smart playlist that lists all popular song that haven’t been played nor skipped for the past two days? This playlist can only include rock and pop songs.

The best set rules you can create without nested rules is the one below.

Hmmm… everything looks alright. But it’s not going to work. You’ll end up with an empty playlist. No song will match your created rule. A song is only allowed to be inside one category3. Instead of matching all rules, you can try to match any rules. The playlist is a mess. All pop and rock songs, including all four rating star or above will get mixed up, not to mention all the songs that haven’t been skipped or played in the last two days.

This is where nested rules shine. Nested rules, or rules within rules, allows you to create many combination set of rules. We can fix it. Correct the rules above by nesting a rule for categories. You can nest the rules by holding Option key and press the plus sign button. The end result is the one below.

Your playlist will now work correctly. It will even update in real time whenever you play or skip a song. This way, you won’t listen to the song you’ve skipped.

Nested rules offers the flexibility for you to combine several common set of rules into one rule. Using it effectively will lead to a more manageable rules library.

Let‘s take another set of rules I’ve set in Hazel. I use Hazel frequently. To move the screenshots from iPhone and iPad to my Mac is one tedious task. To speed up the process, I set up some rules that will detect the image width and height of iPad and move them to my screenshot folder. You can create separate rule to move portrait and landscape screenshots. But with nested rules, you can combine them in one rule, just the like one below.

Not only it’s easier to manage, you may find the rules are easier to fix. Although I suggest you to keep the number of rules low, it doesn’t mean you should combine all the rules together. You should ask yourself whether these rules, when grouped together, are trying to accomplish the same thing. Unless you can answer this question confidently, perhaps it’s better to leave them as they are, as long they’re working fine.

Related Posts:

Get my book for FREE! I’m writing a book about Keyboard Maestro where you can learn to automate common tasks with Keyboard Maestro macro examples. Subscribe to receive the book when it launches. More details »