bpatcher @args multi segment name

May 1, 2011 at 9:53pm

bpatcher @args multi segment name

here is my problem: I am trying to script a bpatcher with some arguments. that is easy enough. However, my bpatcher has audiounit~ in it and I use the Norris spectral units which have names like “Spectral DroneMaker”. Scripting seems to break when there are multiple “words” in a string.
I tried the following with no success:

function bang() {

this.patcher.newdefault(50, 50, “bpatcher”); //works

this.patcher.newdefault(50, 200, “bpatcher”, “@args”, “hello”, 1, 2, 3); //works

this.patcher.newdefault(50, 400, “bpatcher”, “@args”, “hello there”, 1, 2, 3); //doesn’t work

this.patcher.newdefault(50, 600, “bpatcher”, “@args”, “”hello there”", 1, 2, 3); //doesn’t work
}

Is there a trick to this I’m not seeing or is this functionality not supported?

Thanks for any pointers!!!

#56774
May 2, 2011 at 6:26pm

anybody? I really need this functionality!!!

#203470
May 2, 2011 at 9:08pm

Here are a couple of ways to do it:

bpatch = this.patcher.newdefault(50, 200, “bpatcher”);
bpatch.args(“hello there bongos”, 1, 2);

or

this.patcher.message(“script”, “newobject”, “newobj”, “@text”, “bpatcher @args hello there, 1, 2″)

-Ben

#203471
May 2, 2011 at 10:03pm

I see. Thanks so much. gonna give it a try right now.

#203472
May 2, 2011 at 10:33pm

works like a charm. although it seems order of operations is important. if I create a bpatcher like so:

bpatcher = this.patcher.parentpatcher.newdefault(objCoords[0], objCoords[1], “bpatcher”);

bpatcher.name(name + “.maxpat”);
bpatcher.patching_rect(objCoords[0], objCoords[1], 225, 160);
bpatcher.args(nTbP, nTbP2, nTbP3, nTbP4);

I get error messages saying that bpatcher.patching_rect and bpatcher.args are not defined. However, if I put the bpatcher.name at the bottom of the instruction list, like so:

bpatcher = this.patcher.parentpatcher.newdefault(objCoords[0], objCoords[1], “bpatcher”);

bpatcher.patching_rect(objCoords[0], objCoords[1], 225, 160);
bpatcher.args(nTbP, nTbP2, nTbP3, nTbP4);
bpatcher.name(name + “.maxpat”);

everything works fine.

Thanks again!!

#203473

You must be logged in to reply to this topic.