Hi I am trying to use Applescript to pull all the groups in a database ( to populate a dropdown in an HTMLPrompt so I can assign a new record to one of the existing groups)
Referencing the Dictionary I have tried this…
tell application id "DNtp"
set myDBGroups to (name of every parent of database "Test" whose (tag type is group tag))
end tell
But this only returns {} when there are existing groups. Do I have the syntax wrong (or something else). Any help gratefully received
Just a remark: getting the name of a group might be less useful than getting the group itself or its UUIDs. Identical names can occur several times in a database, UUIDs are unique as are the group records themselves.
Thanks @chrillek a good point. In my use case I have a pre-set bunch of 5 different groups in each of my databases so I don’t think I will run into this issue.
The KM macro asks the user to select one of 4 databases and then (dependent on the result) the user can selects which group the record is to go into (populated from the above). Another macro can then be run and allow the use to select from a database specific bunch of tags to allocate to the record
This one function alone has enabled me to drop Drafts never mind all teh other cool stuff I can do
I wonder whether you could add a suggested location (so the top suggestion from the AI) to the initial dialog…? That might well save you time.
I’ve actually just played with classify and it seems it only works within a database rather than across databases; so
tell application id "DNtp"
set theRecords to the selection
set theRecord to first item in theRecords
set theList to classify record theRecord
return theList
end tell
will only propose locations within the database the selected record is currently residing in. As a result, I get no results at all for records within the global inbox. @BLUEFROG is that behaviour intentional? The results are also not the same as the suggestions offered by the *See Also & Classify" inspector. Is there any way to get those same suggestions in AS?
Just wanted to bump this towards @cgrunenberg to respond at his leisure; I’ve just stumbled across this weakness in DTs AS capabilities again when trying to script world domination. DT has such powerful AS support, that the inability to get the list of classification suggestions (as displayed in the inspector) via script is almost an anomaly.