Scripted Triggers and Groups

Hi, is there a way to configure a trigger to be added to a group/folder when creating new triggers in AppleScript add_new_trigger?

I have a tagging script setup for my music. the categories are Mood, Vibe, ... Setting, etc.. Ideally I would like the notch buttons to their respective groups (this is going to be determined by my AS function that puts my music library into a dictionary
--Mood
-----happy
-----sad
--Vibe
----chill
...you get the point...

this works great btw! I just can't find an answer anywhere, so im thinking it's not possible?

tell application "BetterTouchTool"
--add_new_trigger

	add_new_trigger "{
\"BTTTouchBarButtonName\" : \"Happy\",
\"BTTTriggerType\" : 696,
\"BTTTriggerTypeDescription\" : \"Notch Bar Button\",
\"BTTTriggerClass\" : \"BTTTriggerTypeNotchBar\",
\"BTTPredefinedActionType\" : 371,
\"BTTPredefinedActionName\" : \"Show Notification\",		--<-----this will be a named trigger that runs a script to add a song to the "Happy" playlist
\"BTTEnabled2\" : 1,
\"BTTRepeatDelay\" : 0,
\"BTTNotesInsteadOfDescription\" : 0,
\"BTTEnabled\" : 1,
\"BTTModifierMode\" : 0,
\"BTTOrder\" : 1,
\"BTTDisplayOrder\" : 0,
\"BTTMergeIntoTouchBarGroups\" : 0,
\"BTTTriggerConfig\" : {
  \"BTTTouchBarButtonCornerRadius\" : 5,
  \"BTTTouchBarFreeSpaceAfterButton\" : 0,
  \"BTTTouchBarButtonColor\" : \"0.000000, 0.000000, 0.000000, 0.000000\",
  \"BTTTouchBarApplyCornerRadiusTo\" : 0,
  \"BTTTouchBarItemPlacement\" : 0,
  \"BTTTouchBarIconInvert\" : false,
  \"BTTTouchBarAlwaysShowButton\" : false,
  \"BTTTouchBarButtonHoverColor\" : \"248.880000, 146.115000, 128.010000, 181.050000\",
  \"BTTNotchBarVisibilityStandardScreen\" : -1,
  \"BTTTouchBarButtonHeight\" : 15,
  \"BTTTouchBarButtonWidth\" : 100,
  \"BTTTouchBarItemIconHeight\" : 15,
  \"BTTTouchBarButtonTextAlignment\" : 0,
  \"BTTTouchBarAlternateBackgroundColor\" : \"75.323769, 75.323769, 75.323769, 255.000000\",
  \"BTTTBWidgetWidth\" : 400,
  \"BTTTouchBarBorderColor\" : \"0.000000, 0.000000, 0.000000, 51.000000\",
  \"BTTTouchBarFreeSpaceBeforeButton\" : 0,
  \"BTTTouchBarItemIconWidth\" : 15,
  \"BTTTouchBarButtonName\" : \"NotificationButton\",
  \"BTTTouchBarButtonFontSize\" : 12,
  \"BTTTouchBarIconTextOffset\" : 5,
  \"BTTTouchBarOnlyShowIcon\" : false,
  \"BTTNotchBarVisibilityNotchScreen\" : -1,
  \"BTTTouchBarItemPadding\" : 0
}

}"
end tell

Thanks in advance!

okay, im getting closer... I found out how to make a group with triggers inside of them...

[
  {
    "BTTTouchBarButtonName" : "TestGroup",
    "BTTTriggerType" : 630,
    "BTTTriggerTypeDescription" : "Group",
    "BTTTriggerClass" : "BTTTriggerTypeNotchBar",
    "BTTPredefinedActionType" : -1,
    "BTTPredefinedActionName" : "No Action",
    "BTTEnabled2" : 0,
    "BTTRepeatDelay" : 0,
    "BTTUUID" : "93FE9758-BDF8-40B4-A9AF-237D95624DFF",
    "BTTNotesInsteadOfDescription" : 0,
    "BTTEnabled" : 1,
    "BTTModifierMode" : 0,
    "BTTOrder" : 42,
    "BTTDisplayOrder" : 0,
    "BTTMergeIntoTouchBarGroups" : 0,
    "↓↓↓↓↓↓↓↓↓↓ HERE ↓↓↓↓↓↓↓↓↓↓ "
    "BTTAdditionalActions" : [
      { 
        "BTTTouchBarButtonName" : "Close Group",
        "BTTTriggerType" : 696,
        "BTTTriggerTypeDescription" : "Notch Bar Button",
        "BTTTriggerClass" : "BTTTriggerTypeNotchBar",
        "BTTPredefinedActionType" : 309,
        "BTTPredefinedActionName" : "Close currently open Notch Bar group",
        "BTTEnabled2" : 1,
        "BTTAlternateModifierKeys" : 0,
        "BTTRepeatDelay" : 0,
        "BTTUUID" : "72C94654-B8A0-4A74-883F-DA7EFB1A9E07",
        "BTTNotesInsteadOfDescription" : 0,
        "BTTEnabled" : 1,
        "BTTModifierMode" : 0,
        "BTTOrder" : 0,
        "BTTDisplayOrder" : 0,
        "BTTMergeIntoTouchBarGroups" : 0,
        "BTTTriggerConfig" : {
          "BTTNotchBarVisibilityNotchScreen" : 0,
          "BTTTouchBarButtonCornerRadius" : 5,
          "BTTTouchBarFreeSpaceAfterButton" : 5,
          "BTTTouchBarButtonColor" : "0.000000, 0.000000, 0.000000, 0.000000",
          "BTTTouchBarApplyCornerRadiusTo" : 0,
          "BTTTouchBarItemPlacement" : 1,
          "BTTTouchBarIconInvert" : true,
          "BTTTouchBarAlwaysShowButton" : false,
          "BTTTouchBarButtonHoverColor" : "248.880000, 146.115000, 128.010000, 181.050000",
          "BTTNotchBarVisibilityStandardScreen" : 0,
          "BTTTouchBarButtonWidth" : 100,
          "BTTTouchBarItemIconHeight" : 15,
          "BTTTouchBarItemSFSymbolDefaultIcon" : "xmark.circle.fill",
          "BTTTouchBarButtonTextAlignment" : 0,
          "BTTTouchBarAlternateBackgroundColor" : "75.323769, 75.323769, 75.323769, 255.000000",
          "BTTTouchBarItemIconType" : 2,
          "BTTTBWidgetWidth" : 400,
          "BTTTouchBarBorderColor" : "0.000000, 0.000000, 0.000000, 0.000000",
          "BTTTouchBarItemIconWidth" : 15,
          "BTTTouchBarFreeSpaceBeforeButton" : 0,
          "BTTTouchBarButtonFontSize" : 12,
          "BTTTouchBarIconTextOffset" : 5,
          "BTTTouchBarOnlyShowIcon" : true,
          "BTTNotchBarItemVisibleOnStandardScreen" : true,
          "BTTTouchBarItemPadding" : 0
        }
      },
      {
        "BTTTouchBarButtonName" : "TestButton",
        "BTTTriggerType" : 696,
        "BTTTriggerTypeDescription" : "Notch Bar Button",
        "BTTTriggerClass" : "BTTTriggerTypeNotchBar",
        "BTTPredefinedActionType" : 371,
        "BTTPredefinedActionName" : "Show Notification",
        "BTTEnabled2" : 1,
        "BTTRepeatDelay" : 0,
        "BTTUUID" : "89110803-AB0C-43C6-A444-2B1BC1D0D468",
        "BTTNotesInsteadOfDescription" : 0,
        "BTTEnabled" : 1,
        "BTTModifierMode" : 0,
        "BTTOrder" : 1,
        "BTTDisplayOrder" : 0,
        "BTTMergeIntoTouchBarGroups" : 0,
        "BTTAdditionalActions" : [
          {
            "BTTTriggerType" : -1,
            "BTTTriggerClass" : "BTTTriggerTypeNotchBar",
            "BTTPredefinedActionType" : 248,
            "BTTPredefinedActionName" : "Trigger Named Trigger (Configured in Other Tab)",
            "BTTGenericActionConfig" : "test json",
            "BTTNamedTriggerToTrigger" : "test json",
            "BTTEnabled2" : 1,
            "BTTAlternateModifierKeys" : 0,
            "BTTRepeatDelay" : 0,
            "BTTUUID" : "63E6DCE0-B254-4182-BF9F-B9B364D6CB0E",
            "BTTNotesInsteadOfDescription" : 0,
            "BTTEnabled" : 1,
            "BTTModifierMode" : 0,
            "BTTOrder" : 283,
            "BTTDisplayOrder" : 0,
            "BTTMergeIntoTouchBarGroups" : 0
          }
        ],
        "BTTTriggerConfig" : {
          "BTTTouchBarOnlyShowIcon" : false,
          "BTTTouchBarItemPadding" : 0,
          "BTTTouchBarButtonColor" : "0.000000, 0.000000, 0.000000, 0.000000",
          "BTTTouchBarApplyCornerRadiusTo" : 0,
          "BTTTouchBarItemPlacement" : 0,
          "BTTTouchBarIconInvert" : false,
          "BTTTouchBarAlwaysShowButton" : false,
          "BTTTouchBarButtonHoverColor" : "248.880000, 146.115000, 128.010000, 181.050000",
          "BTTNotchBarVisibilityStandardScreen" : -1,
          "BTTTouchBarButtonHeight" : 15,
          "BTTTouchBarButtonWidth" : 100,
          "BTTTouchBarItemIconHeight" : 15,
          "BTTTouchBarButtonTextAlignment" : 0,
          "BTTTouchBarAlternateBackgroundColor" : "75.323769, 75.323769, 75.323769, 255.000000",
          "BTTTBWidgetWidth" : 400,
          "BTTTouchBarBorderColor" : "0.000000, 0.000000, 0.000000, 51.000000",
          "BTTTouchBarFreeSpaceBeforeButton" : 0,
          "BTTTouchBarItemIconWidth" : 15,
          "BTTTouchBarButtonName" : "TestButton",
          "BTTTouchBarButtonFontSize" : 12,
          "BTTTouchBarIconTextOffset" : 5,
          "BTTNotchBarVisibilityNotchScreen" : 0,
          "BTTTouchBarButtonCornerRadius" : 5,
          "BTTTouchBarFreeSpaceAfterButton" : 0
        }
      }
    ],
 "↑↑↑↑↑↑↑↑↑↑ TO HERE ↑↑↑↑↑↑↑↑↑↑↑ "
    "BTTTriggerConfig" : {
      "BTTNotchBarVisibilityNotchScreen" : 0,
      "BTTTouchBarItemPadding" : 0,
      "BTTTouchBarButtonColor" : "0.000000, 0.000000, 0.000000, 0.000000",
      "BTTTouchBarApplyCornerRadiusTo" : 0,
      "BTTTouchBarItemPlacement" : 0,
      "BTTTouchBarIconInvert" : false,
      "BTTTouchBarAlwaysShowButton" : false,
      "BTTNotchBarActivateWidgetModeForGroup" : false,
      "BTTTouchBarButtonHoverColor" : "248.880000, 146.115000, 128.010000, 181.050000",
      "BTTNotchBarVisibilityStandardScreen" : 1,
      "BTTTouchBarButtonHeight" : 15,
      "BTTTouchBarButtonWidth" : 100,
      "BTTKeepGroupOpenWhileSwitchingApps" : false,
      "BTTNotchBarUnhideForGroup" : false,
      "BTTTouchBarItemIconHeight" : 15,
      "BTTTouchBarButtonTextAlignment" : 0,
      "BTTTouchBarAlternateBackgroundColor" : "75.323769, 75.323769, 75.323769, 255.000000",
      "BTTTBWidgetWidth" : 400,
      "BTTTouchBarBorderColor" : "0.000000, 0.000000, 0.000000, 51.000000",
      "BTTTouchBarFreeSpaceBeforeButton" : 0,
      "BTTTouchBarItemIconWidth" : 15,
      "BTTTouchBarButtonName" : "TestGroup",
      "BTTTouchBarButtonFontSize" : 12,
      "BTTTouchBarIconTextOffset" : 5,
      "BTTTouchBarOnlyShowIcon" : false,
      "BTTTouchBarButtonCornerRadius" : 5,
      "BTTTouchBarFreeSpaceAfterButton" : 0
    }
  }
]

This is already A LOT to take in (not a coder or designer by any means...). Will this work with the update_trigger and update the BTTAdditionalActions portion? and use the UUID of this group? I don't want to overwrite all of the buttons/triggers inside of this group, just add them... I was thinking I could store JUST that piece (BTTAdditionalActions) of the json for the group, then append it with the new triggers, but I don't see how that can be done (pulling a piece of a triggers json).

tell application "BetterTouchTool"

update_trigger "89110803-AB0C-43C6-A444-2B1BC1D0D468" json "{\"BTTAdditionalActions\" : \"<<action here which is a function I use to create buttons>>>\"}"

end tell

This is the easiest and most reusable method, but I was also thinking I could do one of these:

  1. just keep deleting and re-adding the group, but im thinking this will be cumbersome...
  2. make each group have about 50 disabled buttons as placeholders. then my script would update each of those...

idk lmk what you think. Thanks!

oh and then automating icons from files (.png). I can start another topic, but is it possible?

I think there is currently not a good way to add to a group (it could be hacked by using the get_trigger function to retrieve the group json, then adding the items, and replacing the existing with "update_trigger".

I'll add a "parent uuid" variable to the add_new_trigger function, this should make that much easier.

What exactly do you need for automating png?

Wow thank you for the quick reply!! That would be incredible! side note regarding the groups: the "open/close notch bar group" action- is there a way to do subgroups? I've tried the following:

open/close group Tags
delay .1s (block)
open/close Display

&
open/close Tags/Display
&

open/close Tags
delay .1s (block)
open/close Display
delay .1s (block)
open/close Tags

also, it seems that I can't open groups inside groups regardless. Im checking the visibility/keep open/other settings now. I think I can make it manageable with UI dividers and groups- its just getting messy since I have so many display setups (workstation, appleTV's etc...) and so many notch bar ideas

Regarding the PNG, I think im gonna scrap that part just because all of my icons need individual attention since im not great at uniformly formatting them. basically I find an icon I like, Pixelcut it, then save it to my "tag project" folder as "TagName - Icon.png" it would've been cool to automate it to grab those too..

This is coming along great btw!! seriously, this app is so amazing!
Most proud of the workaround I did for URL tracks in Apple Music. If anyone has been struggling with this lmk!! (does a conditional miniplayer switch -> choose menu item->other stuff)

Ive also been keeping track of minor bugs, I'll drop them all in the debug board at some point lol. seriously, again, thank you for this app!!

Same issue with opening groups inside of groups for Stream Deck :-/

Hey Andreas, I was wondering if you were able to replicate/identify the issue with activating triggers that are inside groups inside of groups? I believe I've even tried a button to activate a trigger (in this case group) by its UUID.

I wanted to make sure its not a me thing...

Basically... I have 4 different screens my laptop will be connected to at some point. Im trying to keep the conditional triggers organized a bit better (currently utilizing the visual separator), but the list continues to grow and becoming a bit difficult to navigate- multiple BTT windows is helpful, but it crashes more frequently.

*in regards to navigation- a "search triggers" function would be :fire:

Hey sorry to be a pain today, jw if this was still something that was going to be implemented. A lot of the next steps of my project depend on whether this is/isnt available, so im trying to plan out what to do next.

Thanks again!

nvm... just saw the documentation. lets see how this goes!