Forums > Javascript

javascript newbee

May 4, 2013 | 9:10 am

How can I get deviceparameter names with javascript beginning with: var var_1 = new LiveAPI("live_set ");


May 4, 2013 | 5:03 pm

I think you need to take a look at the Live Object Model. The code you’ve posted oes not point to anything with device parameters only to the set as a whole. You need something like var var_1 = new LiveAPI("live_set tracks 0 devices 0"); which will the point to the first device in track 1. You can then get the device parameters and consequently their names. I can knock up some example code for you to take a look at if you like :)


May 4, 2013 | 7:05 pm

var var_1 = new LiveAPI(call_1,"live_set tracks 0 devices 0 ");
var array_1 = new Array();
array_1 = var_1.get("parameters");

but:
for (x in array_1){
post(array_1[x],get(‘name"+ "n");
}
does not work!

I would appreciate if You show me some code!
Thank You very much,
Hermann


May 5, 2013 | 8:30 am

I’m not on a machine that I can actually write and test JS code in Max or Live, but here’s the basic idea, possibly it works.

var theDevice = new LiveAPI("live_set tracks 0 devices 0");
var paramCount = theDevice.getcount("parameters");

for (var x = 0; x < paramCount; x++) {
  var theParameter = new LiveAPI("live_set tracks 0 devices 0 parameters " + x);
  post("parameter " + x + ": " + theParameter.get("name") + "n");
}

Hope this helps, Jeremy


May 5, 2013 | 9:47 am

Hi Jeremay,
it works!!!!!!! Thank You so much!
Had the same Idea, but made a mistake in the in the LiveAPI string.
Once again, Thank You!
Hermann


Viewing 5 posts - 1 through 5 (of 5 total)