Recursive tagging

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

Moderator: Mr_Noodle

Recursive tagging Mon Oct 11, 2021 6:20 am • by WigglyWoo
Hello,

I'm trying to use Hazel for auto-tagging files I drop into a folder based on a lookup table. I can parse the filename against the table and tag accordingly but this only allows me to run the rule once whereas I want to be able to match all instances of words matched in the table and tag accordingly.

For instance, the lookup column in my table might have "table", "chair", "carpet" so for a filename labelled "The chair and table sat on the carpet" I'd like the file to be tagged with "table", "chair" and "carpet"... at the moment Hazel matches against the first found item (in this case "chair"), tags the file "chair" and moves on...

How can I parse the filename from beginning to end and repeatedly look for words that match and add tags for each word found?

Any ideas?

Many thanks,

David
WigglyWoo
 
Posts: 2
Joined: Mon Oct 11, 2021 6:13 am

Re: Recursive tagging Mon Oct 11, 2021 10:18 am • by Mr_Noodle
You can use the "Continue" action in each rule to allow evaluation to continue and have the file match multiple rules. You would need separate rules for each tag, though. The alternative is to write a script.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Recursive tagging Mon Oct 11, 2021 10:22 am • by WigglyWoo
Thanks yes I thought of using the Continue action but would then need to hardcode individual rules for each search term... so was hoping to recursively parse the filename against a CSV file of search terms.

Scripting sounds the best way forward but wasn't sure where to start - can anyone help with any pointers?
WigglyWoo
 
Posts: 2
Joined: Mon Oct 11, 2021 6:13 am

Re: Recursive tagging Tue Oct 12, 2021 8:57 am • by Mr_Noodle
Do you know any programming languages? If not, then maybe AppleScript would be the best as it's easier to cobble something together based on examples out there.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support