is it possible to add a button inside a group via applescript


I'm currently trying to learn the "add_new_trigger" function from BTT.
While I can nicely create a new button, I do not know how to assign those inside a group bar.

Is it possible?

I can see two work-around:

  1. overwrite the "open/close" group and change the visibility of the button accordingly (messy but should work)
  2. use update_trigger on the full group. But then I guess that I need to provide the json corresponding to all of the button already existing in that group.

In both case, I would need an external database (which I already have anyway)



So far I have

	return add_new_trigger "{
  \"BTTTouchBarButtonName\" : \"test2\",
  \"BTTTriggerType\" : 629,
  \"BTTTriggerTypeDescription\" : \"Touch Bar button\",
  \"BTTTriggerClass\" : \"BTTTriggerTypeTouchBar\",
  \"BTTPredefinedActionType\" : -1,
  \"BTTPredefinedActionName\" : \"No Action\",
  \"BTTEnabled2\" : 1,
  \"BTTUUID\" : \"6A5B29EF-3DB2-4966-86BB-A25B472BF363\",
  \"BTTEnabled\" : 1,
  \"BTTModifierMode\" : 0,
  \"BTTAlternateModifierKeys\" : 0,
  \"BTTOrder\" : 3,
  \"BTTDisplayOrder\" : 0,
  \"BTTMergeIntoTouchBarGroups\" : 0
end tell

but as said above this add the button inside the General part of BTT.

Currently you would need to override the whole group as there is no function to insert into a specific group. I think I should add that in one of the next versions.

1 Like