Dates in text that become tag

Hi,

I'm totally new here and have been using Hazel for many years. But right now it's not working for me, so although I love Hazel I'm desperate to try something else for this, and KM is obviously an incredible program. But its overwhelming a little, and I could really use help with this one question.

I have a number of Word files that include dates in various formats, but primarily - Month Day, Year. (October 9, 2019 for example). I want to find those dates in the text and convert them to tags. I'd like this to be done automatically, every time a file is added to a certain folder. I have spent hours trying to figure this out and I'm just quite confused. Could anyone point me in the right direction or help me discern the best way to do this? Many thanks.

Do you mean finder tags? Please provide an example word file with the dates and the exact tag name you want from each date.

Honestly I don't see the utility in doing that. Do you realize that a Finder Spotlight search can search for text in the contents of the file? So you could just as easily (maybe easier) later search for the dates of interest. You could even create a Finder Saved Search to do this. Maybe if I understood your system, how you plan to use these tags later, it would make more sense to me.

Having said all that, I think you would need to do something like this:

  1. Create a Macro with a Folder trigger to get the path of each file as it is added to the folder.
  2. Save the Word file as a plain text file (temp file)
  3. Use a For Each action of the Substrings In collection using RegEx to find all of the dates
  4. Use the KM Set File Attribute action to set the tags for that file.

I hope that helps you get started. If you still need help, feel free reply with more details and real-world examples. Please read:
Tip: How Do I Get The Best Answer in the Shortest Time?