How do you assign scripting names with the Js object?

cpeterlee's icon

More specifically, I want to be able to assign unique names to dynamically instantiated objects and then send specific messages to specific objects. Any ideas on how to do this?

pdelges's icon

Here is what I do:

function setpatchername (aString)

{
    if (aString != "#1")    // so, no error when #1 received
        this.patcher.box.varname = aString;

    outlet (0,"bang");
}

Max Patch
Copy patch and select New From Clipboard in Max.

I use this code like this:

HtH,

p

MIB's icon

you mean something like this:

this.patcher.newdefault(50, 5, "nslider", "@presentation", 1, "@presentation_position",
50, 5, "@mode", 1, "@varname", "myName");

cpeterlee's icon

Yes brilliant, thanks guys.

cpeterlee's icon

I'm getting "varname" is not a valid attribute argument for a jit.qt.movie object...