AppleScript: Get (custom) meta data of selected group in inspector pane "See also & Classify"


does anyone know how to get the (custom) meta data of the current selected group in the inspector “See also & …” with AppleScript (or JavaScript)?


If that’s possible at all, you’ll have to resort to GUI scripting. Which is a long, winded, and wobbly path that I’m not going down. Ever.

What’s the problem that you’re trying to solve?

Thanks for the quick reply. I have saved custom meta data for the groups. Specifically, for example, I want to send an email with the currently selected objects and for this I need the custom meta data of the selected group in the “See also” inspector panel. I want to create the mail with Applescript using the meta data. This is only one scenario. I have many workflows i could use the custom meta data of the selected group in the inspector “See also”. Do you see another possibility to select a group so quick in order to use the groups’ (custom) meta data on current selected items?

A group that you see as “selected” in the Inspector is not part of the selectedRecords properties in DT.

Using KM or Better Touch Tool or so, you could perhaps simulate a right click on the group your mouse is over (note: that is not necessarily the same as the “selected” group) and then activate “Show group in database” from context menu.

Then the group is properly selected, and you could start using selectedRecords to get at its data, send e-mails, whatever.

But the initial step is the one causing the issues.

Note: Groups aren’t shown in the See Also (Documents) section of the inspector, only in the Classify (Groups) section.

I want to send an email with the currently selected objects and for this I need the custom meta data of the selected group in the “See also” inspector panel.

You can’t get classifications for multiple selected items.

Please clarify the actual situation more clearly.

In BTT, you could the action
select context menu (5)
to show the group your mouse is currently over in the main DT window and select it. Now, copy the UUID of this action (right click, context menu) and write your DT script:

(() => {
  const app = Application("DEVONthink 3");
  const btt = Application("BetterTouchTool");
  btt.triggerAction("THE UUID YOU JUST COPIED");
  // perhaps wait a second with delay(1);
  const group = app.selectedRecords[0];
    Do with the group whatever you want
1 Like

Ok, sorry for the wrong name, I meant “Classify”. As you can see from the screenshot, it is also possible to select several objects and then select a group in the inspector panel by entering parts of the group name in the search field of the inspector panel. I would like to “take” data from this custom meta data with an Applescript in order to then use this meta data for further actions in the Applescript (on the selected items in the main window).

I’ll check that with BTT. Maybe i could find another quick way to select a group to get the meta data of this group than with the See also & Classify panel. I will report here.If anyone has another idea, I would be very grateful if you could share the idea with me…

If you’re already entering a desired name, i.e., you know what you’re looking for, why aren’t you just navigating directly to that group? Or at least, Control-clicking the group in the Classify section, and choosing Open or Reveal in New Window with the Option key held?

I think it hasn’t become clear yet what exactly I intend.

I would like to use a group’s metadata for operations on the current objects in the main window.

For example, the metadata also contains a link to a database (Tap Forms), so that I could, for example, run a script in the database with specific metadata of the currently selected object in the main window.

That would save me a lot of clicks.

Concrete example:

Selected object (in the main window) contains the sender, date and a special ID in the metadata.

A specific group contains a link to an entry of the database in the metadata.

I would like to run an Applescript that reads the desired metadata of the selected object and invoke a script in the database on a the entry which itself creates a new child record in the database with the meta data of the selected object.

The only unresolved problem is that I can read the link to the entry of the database as quickly and easily as possible. I hope I have explained this better now.


Which database – Tap base? DT? Not clear at all.

Do you mean something like this?

  • You have a record selected in your main window.
  • This record has certain metadata
  • It is also “somehow” related to “a group” (which group? what is the relation?)
  • this group has also certain metadata, one of them being a “link” (rather an URL, I guess) to a “database” (probably Tap base). Or to a record in the database, or to something.
  • now you want to get from the record to the group and its link

If the currently selected record is a child of the group, that’s kind of easy. If not – what would be the relation between the record and the group?

“Kind” of easy because we do not know if the desired group is the only parent of the child or you have a hierarchical group structure with the child buried somewhere and the desired group being the top level parent – or whatever.

Yes, Tap Forms database.

I think it doesn’t matter which relationship the item in the main window has to the selected group. I just select the group in the inspector panel to (hopefully) get the meta data of this group.


Yes, i want to get meta data of both in order to use them in an external script (for example in Tap Forms).

Yes, it would be, if the currently selected record is a child, but it isn’t. Let us assume there is no “relation” between the record and the group.

Thanks for your thoughts…

The easiest way would be, if there will be a function for Applescript (or JXA) to “speak” with the selected group in the “Sea also & Classify” inspector pane.

As I said: It’s not selected like the record is selected. It is simply “marked”. And there’s no way to get at the group. Which lead to my “how is the record related to the group?”.

It would be up to @cgrunenberg to say if it will ever be. Personally, I wouldn’t see why. If you want your record to be in that group, you can move it there. Afterward, its parent is the group and you can script whatever you want.

If you don’t want it in that group, why is the group relevant for the record?

First request of its kind ever, therefore no such plans actually.

1 Like

Ok, thanks.

I think I’ll try to do the following via Applescript:

  1. get uuid of record of current parent group (=“initial group”) in main window
  2. get uuid of the current parent group
  3. move to selected “classify group” (with key stroke CONTROL-C)
  4. get uuid of the parent group (=“classify group” from step 3) where record of step 1 is located after moving in step 3
  5. set custom meta data to record (uuid step 1) with values of the custom meta data of the “classify group”
  6. move record back to “initial group”
  7. execute external scripts (with added custom meta data from the record)



Again… since you’re typing in the name of a known group – because you can’t classify multiple selected documents without providing manual input – why aren’t you just dealing with the known group and its properties directly?

For example, you can quickly navigate to a known group via the Go > To Group popover.

1 Like

:rofl: but it works