What I’m trying to achieve: I would like to use a smart rule with embedded script (that I can adapt per requirements) to search the contents of a particular database or group for a list of words (character names, locations, etc.) and assign a tag(s) based on this criteria.
For example, if I am breaking down a screenplay for further review and I have split each of the scenes into individual markdown tags (that do not contain any #hashtags in content), I want to be able to run the smart rule to search all the files contained within that project folder and extract the words I’ve assigned within the script to tags.
I‘m working on something similar but instead of defining which words should become tags inside the smart rule I create empty tags first. Still some experiments and testing needed but maybe I can share first results later
I’ll try explain again, hopefully you can piece together an idea of what I’m trying to achieve by outlining my manual process
Search for a character name
Tag the files that contain that name
Search for a particular location
Tag those files with that location
Search for time of day (in screenwriting this is either DAY or NIGHT)
Tag those files with the day/night
A time consuming process I’d love to try automate.
I start with a certain set of search criteria (a list of keywords I know I want to tag the files with). I know the project I want to search within. I just don’t know how to use Smart Rules to make my life a little easier so I can spend less time on meta maintenance and more time on the creative work.
One Smart Rule with a list of pre-defined search terms (words) that searches my database for those words. If the word is present, a tag is assigned. If the word is not present, no tag is assigned.
The best I can offer as an example of the workflow is this screenshot from a Hazel setup.
Note: I am not unifying the Tags for clarity of the Tags I premade.
PS: I nested the character tags just as an example. I am not advocating for or against this practice.
Maybe I lost something in sintaxe. In my case I want to rename a compose name like “Rumo Certo” or “Old Way” (it is not just one word but 2 or 3). But no tags are ass. What I miss?
The Add Tags From Document action might be more useful and doesn’t require this step. Just enter the desired tags and DEVONthink will add those which are found inside the document.
Sorry to open up an old thread… is it possible to run a Smart Rule using Add Tags from Document action for multiple tags, or do I have to create a Smart Rule for each individual tag I wish to apply this way?
For example, I have multiple student worksheets, some for elementary, pre-intermediate and intermediate, and I want to apply tags based on this criteria.
Thanks BlueFrog, I’m trying to bypass manually creating tags first and have the Smart Rule automate this process for me based on the content.
You’ve indicated the use of | before to separate the words in content to search for and then apply from a selection of tags in the smart rule, but I can’t remember how to do this using @cgrunenberg ‘s solution