Change GUI text from the script

I can’t find a solution for a simply task of changing text on the GUI from the script. Basically I need to display a value of a certain string variable on a Text/Label element (whichever works).

String’s value changes via function parameter, smth like this:

function reverb_big_small_button_changed()
if(reverb_big_small_button==1) then

Why don’t you define parameter with those values in first place? Then you don’t have to change anything.

defineParameter("reverb", nil, 1, {"small", "big"}, function() print(reverb) end)

This will give you values 1 and 2. If you need 0 and 1 you can change it to:

defineParameter("reverb", nil, 0, {[0] = "small", "big"}, function() print(reverb) end)

Ok, I’ll explain it more. I have a button on the GUI, which controls via script a certain effect on a bus. So this button is connect with a parameter in the script and this pair work fine. However I would like this button, when clicked, also to change a title on a Text/Label element. How this can be achieved?

I understand. But if you create parameter like this any text control on macro page will display the string, while the actual value of the parameter is number. So you can skip the extra step of creating new parameter for the label/text.

So you can achieve the same effect simply by defining your already existing parameter as indexed string array parameter.

But if you really want to do it like you said just create a string parameter and connect that to a text control on macro page.

You could try it like this:

  • Create ui script parameter
defineParameter("reverb", nil, 1, {"small", "big"})

Reverb.vstpreset (8.8 KB)
Reverb multi.vstpreset (8.8 KB)

Thanks a lot! I would never guess it by myself)
However, is it possible to accomplish this task not resorting to UI scripting, but have it all in Program script? Because for me it’s like a hassle to go back and forth between both scripts. I’d prefer to keep it all in one piece of code.

Yes. Create a string parameter in your main script. You can make it read only if you want to.