How to dynamicaly update text widget?

Hi all - I was looking for a way to pull track names from ableton to be displayed in OSC. The closest I got is using liveOSC2 remote script. I have a text widget and the osc address /live/track/name (with preArgs indicating track number) should return the track name. Now this seems to work only when renaming a track inside ableton - I guess that renaming the track "sends" out the track name which cause the text widget to update. however this does not work when loading a project - the text widget is not getting updated with the new labels.
is there a way of dynamically updating the widget - maybe at set intervals? or maybe creating a master button that can update several widgets (all track labels) when tapped?

You can send a message periodically from open stage control using scripting:

// onCreate script of a widget of your choice
setInterval(function(){

  send('127.0.0.1:5555', '/address')

}, 1000) // every 1 sec

Now I don't know what should be sent to make the DAW send the track names.

Thank you very much for this - got it to work. however every time it sends a request the text in the widget flashes which was annoying so instead I created a button that send the request on demand - it does the job for me

Following my reply above I was wondering how to use switch value in the send function...

I am trying to construct a 6 track mixer with a switch (id SwitchTracks) that select trks 1-6, 7-12, 13-18 etc. the switch values are 0,6,12 etc. At the moment, as per my last reply I now have a button that pull the track names on tap using the send command - this is what i have in the buttons onValue

send('127.0.0.1:9001', '/live/track/name', #{@{SwitchTracks}+0});
send('127.0.0.1:9001', '/live/track/name', #{@{SwitchTracks}+1});
send('127.0.0.1:9001', '/live/track/name', #{@{SwitchTracks}+2});
send('127.0.0.1:9001', '/live/track/name', #{@{SwitchTracks}+3});
send('127.0.0.1:9001', '/live/track/name', #{@{SwitchTracks}+5});
send('127.0.0.1:9001', '/live/track/name', #{@{SwitchTracks}+4})

I am trying to include the same script in the switch's onValue so switching between tracks update the names without needing to click the update button again BUT i cant figure out how use the switch own value within the script args...

ALSO, while the script above works inside the button widget all the line numbers show in red so I think my syntax might have an issue...

The advanced syntaxes should not be used in scripting properties (See the big warning at Scripting - Open Stage Control), you can write get('this') to use the widget's own value in its script.

thanks once again - took me a little time to understand how to add it as I have no coding knowledge so I ended up with this solution (in case anyone else looking for the same issue)

var val = get('this');
send('127.0.0.1:9001', '/live/track/name', val+0);
send('127.0.0.1:9001', '/live/track/name', val+1);
send('127.0.0.1:9001', '/live/track/name', val+2);
send('127.0.0.1:9001', '/live/track/name', val+3);
send('127.0.0.1:9001', '/live/track/name', val+4);
send('127.0.0.1:9001', '/live/track/name', val+5);
send('127.0.0.1:9001', '/live/track/mute', val+0);
send('127.0.0.1:9001', '/live/track/mute', val+1);
send('127.0.0.1:9001', '/live/track/mute', val+2);
send('127.0.0.1:9001', '/live/track/mute', val+3);
send('127.0.0.1:9001', '/live/track/mute', val+4);
send('127.0.0.1:9001', '/live/track/mute', val+5)

Bonus:

var val = get('this'),
    target = '127.0.0.1:9001'

for (var i=0; i<6; i++) {
  send(target, '/live/track/name', val + i)
  send(target, '/live/track/mute', val + i)
}
1 Like

thanks once again - this is definitely neater than my long script... i guess I should use variables more often...