Dynamicly changing arguments for [js]

bronzebygold's icon

I'm using the example code from the [polybuffer~.maxhelp] file for loading the polybuffer~ using JavaScript in the [js] object. (You can find this example under the "JavaScript" tab in the polybuffer~.maxhelp file.) I need to be able to change the second argument of this [js] file however, the one that sets the target polybuffer~ name. I guess this requires a change to this line of code: var pb = new PolyBuffer(jsarguments[1]);. I don't really know much about JavaScript though. What change do I need to make in order to dynamically change the [js] argument?

MIB's icon

haven't tested this but should work I think:

function changeArg(a)
{
    pb = new PolyBuffer(a);
}

then use a message box with [changeArg myNewAwesomeArgument] and send it to the js...

bronzebygold's icon

Thanks, MIB. That works great!