OSC to Get Label?

Hello all,

I have a script that sets a “Label” widget to a specific string of text. I would like to then display this text in a field on TouchOSC, but I cannot find the proper OSC command. I have tried /label_1/GetCaption, but I’m guessing that “caption” is different than “label”?

Extract Label Text.gig (35.3 KB)

There is a monitor window you can display at the bottom of TouchOSC that will display the messages being sent by GP. So as long as you have OSC enabled on the GP label widget, you should see what address it has via the TouchOSC monitor.

1 Like

That’s the problem; I do have OSC enabled on the label widget in the example file. However, I am only getting OSC messages coming through from the button Widget, and not the label.

If you’re using gp script to set the label, then you can then define an OSC message to send that same text to TouchOSC. In that case, you can make the address whatever you want, as you define it in gp script.

When I’m back at the computer I can take a look at your gig file.

Because you’re already using GP Script, the simplest option will be add a line to send an OSC message out with your label text:

var button_2, label_2 : Widget

On WidgetValueChanged(newValue : double) from button_2
    select
        newValue == 1 do
            SetWidgetLabel(label_2, "on")
            OSC_SendString("/label_2", "On")
        newValue == 0 do 
            SetWidgetLabel(label_2, "off")
            OSC_SendString("/label_2", "Off")
    end
end

In TouchOSC, as long as you match up the address it will work:
image

Option 2 is to use the scripting in TouchOSC to update the label text. Because there was already an OSC message being generated by the button widget in GP, you can add a script in TouchOSC to update the label text. But this means you have to learn another scripting language!
OnOffButton.tosc.zip (1.6 KB)

OSC-Button-Label

1 Like