bpatcher @args multi segment name


    May 01 2011 | 9:53 pm
    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!!!

    • May 02 2011 | 6:26 pm
      anybody? I really need this functionality!!!
    • May 02 2011 | 9:08 pm
      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
    • May 02 2011 | 10:03 pm
      I see. Thanks so much. gonna give it a try right now.
    • May 02 2011 | 10:33 pm
      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!!