Variables passed to named triggers

So I have a bunch of touchbar buttons that run basically the same Python script except for a single variable. Is there a way I can set up a single named trigger and pass a variable from the button to the Python in the named trigger?

I don't think that's currently possible. But as a workaround, you can use existing persistent variables as in-between I think. So the buttons set a persistent variable on tapping which calls the same script which uses the value of this variable to determine the parameter.

Of course. thanks

I'd assumed there was going to be a relatively simple way to access BTT variables from a script but the best I can find is using requests.get() and the get_string_variable from the named trigger python script. Which is going to involve all sorts of code duplication across named triggers that I'd rather avoid. There isn't something simpler, I suppose, is there? For example, HUD displays can use curly braces to show BTT variables.

Have you considered using custom url schemes or the builtin web server which allows those commands like

open ""

There are details in the manual.

I have. What starts off as a relatively simple set of actions gets clunky very quickly with, say, 20 named triggers that are each used in, say 5 or 6 buttons. And that each script action would need python code to fetch the variable and another action to set the variable in the first place, it starts to become not worth the effort to set up. When you factor in the overhead of maintaining such code - port or IP change, for example - it becomes intolerable.

This kind of thing is one of my criticisms of BTT. If, again, for example, I need to set up, say, 30 buttons that do broadly the same thing but with minor differences, the time it would take to set up and maintain becomes not worthwhile. It's a process that doesn't lend itself to hand-building of UIs. A config file would be much more suitable.