The script:
You need to setup two custom meta data fields:
(a) You input the OR matching words in “tagor”, and those for the AND conditional match in “tagand”. Each single word must be separated by comma, no phrase is accepted. and (b) Word cannot contain symbols (e.g. “c.context” or s.test" won’t work). This auto-tagging mechanism is limited by the property of DT’s concordance. Finally, Tags SHOULD NOT be excluded from tagging. Otherwise, new and identical tags might be created.
e.g.,
The main script “TaggerV1 (public)” has four settings
(1) topTagGpLocation: contains the tags to be used in auto-tagging and in the tag-tree for additional tagging. If you want to limit the auto-tagging and the constrained tag-tree to a smaller set, create a tag group and move the relevant tag-groups under it.
(2) theNewTagsLocation: new tags that are created in the process will be place in this group. You’ll need to create the group before using the script.
(3) oneItemAuto: the default method is to use semi-auto tagging if only one item is selected. If oneItemAuto is set to true, auto-tagging applies even when only one item is selected.
(4) hourBetweenUpdate: the tags and each tag’s predicates are save to a plist file for performance reason (the auto-tagging is almost instantaneously by this caching method). If the last update time is more that “4” hrs from now, Tagger will suggest to update the list when u run it (u can choose cancel to bypass the update). If u click ok, the script will take a few seconds to update the list before the auto-tagging process. The script will update the list before the tagging without choice if the list have only been updated on the previous day.
property topTagGpLocation : "/Tags" -- the tag group that contains all tags
property theNewTagsLocation : "/Tags/New Tags" -- place to save newly created tags
property oneItemAuto : false -- apply autotagging even for one item
property hourBetweenUpdate : 4
EDITED 2019.08.26 with V1.1: add one more option for item’s name-only auto tagging
property nmOnlyMatch : false -- set to true if only the name of item is used for autotagging
The manual update script “Tagger Manual Update (Public)”:
Put this script under the script menu. Run it if you want to do a manual update and the last updated time will be renewed.
The plist “Tagger.plist”
You need to put this empty plist into a specific location: “~/Library/Application Scripts/com.devon-technologies.think3/Toolbar/Tagger.plist”. The plist will be populated with tags info when the main script is run for the first time. Tags info for multiple databases can be saved under this plist.
Reminder:
(1) I believe that the concept of auto-tagging is more applicable to one or few items and to items with small amount of text at each activation (snippets of text, bills, pdf<20pages, etc). Because it is very difficulty to control the quality of auto tag-assignments to a large number of items or items with many words. Perhaps the best application of tagger is to classify an item when it’s in the inbox (BUT the items cannot be in global inbox because Tagger won’t know which tags list to call), or an entry of project description, or some literature that are just downloaded from publishers.
(2) Smart rule and smart group can achieve the same tagging assignment AND under much more advance predicates. Personally, I think Tagger is cleaner (no bunch of rules and groups), and allows ad hoc based adjustment. Because u will know which tags’ predicates to change immediately after the wrong or missing tag-assignment, and u don’t need to find out which smart rule/group have you included the key words and tags for auto-assignment. Besides, I have more fun in using Tagger. Nevertheless, the powerful smart rule/group are doing exactly what they are meant for: dealing with large number of items.
(3) The same concept can also include group-tags. I’m thinking…
(4) Without the comprehensive DT script dictionary and the new feature of custom metadata fields, this will never happen. A big thank you to DT!
(5) My apology in advance: I haven’t thoroughly test the script under different scenarios. I develop the script for my own use. I won’t be able to help anyone to debug or add functions as long as it works for me. I hope someone will make Tagger better and post it to the forum.
(6) For those who are really into scripting, I discovered a new trick: running loops or any execution of very large list by first defining the list in a “script object” speeds up the process by at least 100%. There are a few discussions on the web re this mysterious trick in AppleScript.
The three files
Archive.zip (503.6 KB)
EDITED 2019.08.26: Main script TaggerV1.1 (no change on the other two scripts)
(1) add name-only auto tagging and (2) very minor change in codes based on the latest DT dictionary on custom meta data.
TaggerV1.1 (public).scpt.zip (480.5 KB)