Adding Tags to Files by searching a file with a tag list

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

New user here, loving Hazel!!

Apologies if this is explained somewhere I've looked in the forums and the manual unsuccessfully.

I use Resilio Sync to manage files between devices and users. I have a series of "inboxes" and Hazel processes those for me.

I'd really like to:


1. Add a tag to a file such as "tag-me" to tell Hazel to work on the file
2. Search sequentially through a list a keywords kept in a single text file and if those words are found in the file being processed then add a tag using that keyword
3. Remove the "tag-me" tag
4. File the file using whatever other rules I've set up

This enables me to keep a single keyword file up to date and have Hazel tag accordingly.

An example of the keyword file might be:

Code: Select all
kanji, ryokan, Japan, finance, recipe, chicken, vegetarian


The file being processed might read:

In Japan it's difficult to access vegetarian food except at ryokan


The outcome should be that the tags:
Code: Select all
Japan
Code: Select all
vegetarian
and
Code: Select all
ryokan
would be added to the file being processed.

I'd like to avoid writing bash or AppleScript as I'm not great at it :P

Thanks for any help.
Pelorus32
 
Posts: 14
Joined: Sat Feb 29, 2020 2:48 am

Unfortunately, a script is necessary here as the built-in functions don't have support for reading from an external file like that. There is a feature planned to provide lists in Hazel but it's not finalized whether it will be implemented. Cases like this, though, will help to form how the feature gets designed though.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks, let's hope that the lists capability makes the cut in Hazel...if you need a beta tester for it I'm in :D

Mr_Noodle wrote:Unfortunately, a script is necessary here as the built-in functions don't have support for reading from an external file like that. There is a feature planned to provide lists in Hazel but it's not finalized whether it will be implemented. Cases like this, though, will help to form how the feature gets designed though.
Pelorus32
 
Posts: 14
Joined: Sat Feb 29, 2020 2:48 am


Return to Support