Dynamic Tags in Hazel

I am trying to get Hazel to add some tags to certain PDFs as they pass through my action folder. One of the tags needs to be just a part of the file name. So, a file catted ‘Ronnie - 2020-12-31 - £53.40 - Invoice’ I would like Ronnie to become a tag, OR ideally if it is possible for the tag to be ‘: ronnie’. This last part is a luxury I can manage without though. Some advice would be much appreciated! Thank you.

Assuming the file name structure is consistent (the first word is always the desired tag), what you want to do is use a Hazel rule where Name (matches), and then in the text field, choose the “Custom Text” item in the popup window.

This will open another popup window, when you name and define your Custom Text (this turns it into a Hazel “token”). Just name it “Tag”, and in the criteria box choose the “Anything” option.

In the Actions section, choose “Add tags”, then choose Dynamic Tag and enter the colon, space, and then click the new “Tag” custom token we built earlier.

Once the custom token Tag item is chosen, you can click on it for a menu to edit it, and make it lowercase (among other options).

1 Like

Thank you for your incredibly helpful solution to my problem!

My pleasure, glad to help!