LiveAPI via Javascript objects

Venetian's icon

Hi,

I'm familiar with java in Max and some Javascript. Is there a simple way to control Live using Javascript commands (and that uses the same syntax as the patcher objects) - so e.g. play track 1, clip 2?

I looked at the LiveAPI javscript object page in help, but I couldn't see if it is a particular object or if I write my own javascript file?

Also, here is the code (from example at the bottom of help page), which didn't yet work for me. If you have a working example, that would be great.

Any help appreciated.

Andrew
_ _ _ _ _ _ _

var api = new LiveAPI(this.patcher, sample_callback, "live_set tracks 0");

if (!api) {
post("no api objectn");
return;
}

post("api.mode", api.mode ? "follows path" : "follows object", "n");
post("api.id is", api.id, "n");
post("api.path is", api.path, "n");
post("api.children is ", api.children, "n");

function sample_callback(args){
post("sample calller ");
}

negotiator's icon

remove the line "return;"

if that doesnt help, try the following instead of the old first line, but i seriously doubt that the argument "this.patcher" is wrong:

var api = new LiveAPI (this, sample_callback, "live_set tracks 0");

adamribaudo's icon

I ran into this same problem. Just remove the "return;" statement. Seems to be a typo in the documentation.