Sending a message from MXJ to JS

Nat's icon

Hello, I have an MXJ connected to a JS and I need them to communicate.

In my JS script I have a function called "get_min_max" that I want to use to gather 2 values from MXJ. In MXJ I am trying to send out this message through an outlet but from what I understand, the whole message is treated as a symbol so JS doesn't understand it. Here is the message I am trying to send (using a cable between MXJ and JS) :

outlet(0,"get_min_max "+low_sample+" "+high_sample);

get_min_max being the name of the function and low_sample and high_sample being the 2 arguments I want to send. Any efficient way of doing this ?

Thanks,

Nat

topher lafata's icon

Atom[] myout = new Atom[2];
...
...

myout[0] = Atom.newAtom(min);
myout[1] = Atom.newAtom(max);
outlet(0,"get_min_max ",myout);

topher lafata's icon

once java 1.5 is a little more entrenched on OS X
we can look at providing outlet(String msg, ...)
type of functions.
topher

Nat's icon

Thanks Topher !

Had forgotten about Atoms, will have to dig deeper into that !

Nat