Saving Item Name as a Variable

Hi all,

I'd like to make it so that as I make new buttons for my floating menu, when I click that button, the name is passed on as a variable to the action script.

For example if I have a button trigger named Apple, and the action script is basically "Hello {{trigger name}}" then it should print Hello Apple,

Is this possible? Struggling a bit and realizing it might be trickier than it sounds.

For context, have a "scene"-switching project associated with a growing list of parameters ("breed", "weight" etc; values would change depending on the scene selected) so being able to name the button the actual parameter would help keep things organized and flexible.

Solved actually, sorry, posted a bit too soon.

For anyone with a similar question, below's a working js script. You need to paste your own button's UUID.

async function pasteName() {
// 1. Fetch this button's own trigger JSON by its exact UUID
let result = await callBTT('get_trigger', { uuid: 'YOUR BUTTON'S UUID' });

// 2. Parse the returned JSON string
let trigger = JSON.parse(result);
if (Array.isArray(trigger)) {
trigger = trigger[0];
}

// 3. Extract the name (prefer BTTMenuName, fallback to BTTTriggerName)
let name = (trigger && (trigger.BTTMenuName || trigger.BTTTriggerName)) || '';

// 4. Trigger BTT's native 'Paste Custom Text' action (Action 118)
let pasteAction = {
"BTTPredefinedActionType": 118,
"BTTActionTypedString": name,
"BTTActionPaste": 1 // 1 ensures it pastes the text instantly rather than typing it out
};

await callBTT('trigger_action', { json: JSON.stringify(pasteAction) });

return name;
}

you can also get the uuid via

let uuid = await get_string_variable("BTTLastTriggeredUUID");

callBTT is supported but is kind of low level, you can use the functions directly :slight_smile:

let uuid = await get_string_variable("BTTLastTriggeredUUID");
let resultJSONString = await get_trigger({uuid: uuid});
let trigger = JSON.parse(resultJSONString);
if (Array.isArray(trigger)) {
    trigger = trigger[0];
}

let name = (trigger && (trigger.BTTMenuName || trigger.BTTTriggerName)) || '';

let result = await paste_text({text: `<strong>${name}</strong>`, format: 'NSPasteboardTypeHTML', insert_by_pasting: true});

return result;

Hey guys just a quick request. What is the original video of MVPKeen's  famous clapping gif? According to the background logo it appears to be at a  GSL event. Link to the

Thank you, Andreas!