Experimental: Auto-Group Script

Another script that is likely totally unnecessary, but:
(1) I want to know how much can script do to utilise/integrate the function of DT3.
(2) I am exploring a kitchen-sink approach of filing. Although I’m not sure about whether the script has achieved the purpose.
(3) DT3 has excellent out-of-the-box filing capability. The function “see also and classify” (if u are unsure about the filing) and smart rule/group (if u are sure about the criteria of filing) can do everything this script does if not much more. I want to add something in between.

1st post for the demo. 2nd post for the script.

DEMO: There are several modes, this semi-auto mode is my favourite:

(1) In this demo, you will see that the list of “DT Suggested Groups” is different from the list in “Suggested Groups Based on Matching…” , I will explain later:

Select three items with tags

Run the script button “AutoGroup”. A list showing both the groups suggested by the script and the groups suggested by “see also and classify” function (local database only).

After clicking “OK”, another list for the next item. Notice that the viewer window will also change to the next item.

Next item. This time “Add New Group” is selected. A new group can be created by group selector.


The log will be showing the executed replications

(2) Why two suggested lists: This script’s list is based on tag- or name-matching. An item (a) with tags that contain all tags of a group or (b) with a name that includes any words in the WordOR and any words in the WordAND custom meta-data fields of a group will be matched to that group. The DT’s list is based on content-matching, and is generated by the function “classify” for the current database. That’s why the DT list is also different from the one on the inspector bar.

1 Like

The settings:

(1) A few options. User can save different versions of the same script for different purposes.

-- "S"-suggest gps and choose to confirm for each document  "M"- no suggestion, show all gps for each document in selection
--  Very unlikley to be used: "B" Batch mode, no suggestion, same groups for selection, "A"- just replicate to suggest gps automatically for each document 
property gpSelectionMode : "S"
property gpMatchToTags : true -- suggest gps by the tags of group
property gpMatchToName : true --suggets gps by matching words in field "tagor" and conditional to words in "tagand
property numClassifiedToGps : 5
property hourBetweenUpdate : 4

gpSelectionMode: I think “S” semi-auto is the most sensible option. “A” Automatic replication is a bit dangerous, better to test it first and I suggest to enable only gpMatchToTags when using this mode. However, all replications are recorded in log, so user can always undo the actions “one-by-one”.

gpMatchToTags: suggest any group if ALL of its tags are found in the tags of the item. So, I am assuming tag-before-group workflow for this option.

gpMatchToName: suggest any group base on matching the words in the name of the item with the words in the group’s custom meta data fields. The fields are used in common to TaggerV1.1: auto and semi-auto tagging (new option for item's name-only matching). In Tagger, the words are entered in tags. In AutoGroup, words are entered in groups. Punctuation is accepted. For example, user can match “X.XXX” or “Y-YYY” to the name of the items to be grouped.

numClassifiedToGps: the number of DT suggested group to show.

hourBetweenUpdate: same meaning to the Tagger script. When user run the AutoGroup, and if the list of groups and their info haven’t been updated for 4 hours (hourBetweenUpdate:), the script will suggest user to update the list.

The scripts:
(1) Two scripts and one plist file. AutoGroup is the main script, AutoGroup Manual Update is the script for you to manually update the list after you make changes in the tags or wordlist in those groups.
The plist file is essential for maintaining instant response for the script. My scripting is not good enough to know how to optimise the speed on real time processing of the entire database groups’ data.
(2) Tagger and AutoGroup are work-in-progress. I’m still figuring the optimum workflow of tagging and filing. Any suggestion on the workflow and coding are very much welcome!
AutoGroup.zip (522.2 KB)