Disabling groups via action

Hi. Is it posible to disable and enable a folder (⌘D) with an action? I am using multiple presets for that, but I wonder if there is a way to do it with an action.

Reason is that I have a growing collection of presets, and it is cumbersome to export all of them to keep current backups of everything.

There's probably a simpler way than my proposed solution, but I'll share never the less – I'm more comfortable scripting BTT than using the GUI.

Running this JavaScript code in a Run Real JavaScript action will toggle a folder based on its UUID which you can obtain by right clicking on the folder and selecting Copy Selected Item UUID.

(async () => {
    // Define the trigger/folder UUID as a variable.
    // ⚠️ Replace this with your actual folder UUID
    let folderUUID = "B5C3E953-EE53-481C-86BA-C562B5D80022";

    // Retrieve the folder configuration using its UUID.
    let folder_config = await get_trigger({ uuid: folderUUID });

    // Parse the JSON string into an object.
    let folder_config_obj = JSON.parse(folder_config);

    // Get 'BTTEnabled2' to determine if the folder is currently enabled (1) or disabled (0).
    let BTTEnabled2 = folder_config_obj.BTTEnabled2;

    // Toggle the state: if enabled (1) then disable it (0), and vice versa.
    let newState = (BTTEnabled2 === 1) ? 0 : 1;

    // Replace the old value of BTTEnabled2 with the new state.
    folder_config_obj.BTTEnabled2 = newState;

    // Prepare the update definition object.
    let updateDefinition = JSON.stringify(folder_config_obj);

    // Update the trigger with the new configuration.
    let updateResponse = await update_trigger({ uuid: folderUUID, json: updateDefinition });

    // Return the update response to BetterTouchTool.
    returnToBTT(updateResponse);
})();