Getting the name of a subpatch from inside it?


    Jan 03 2008 | 8:58 am
    Hi list
    I'm trying to create a named subpatch with a pattrstorage outside it, referencing pattrs inside it. I want to retrieve presets for only certain pattr objects in the subpatch, and I want to be able to make many copies of the subpatch and have each one automagically query the main pattrstorage object for preset data about its included pattrs without having to name each one explicitly.
    My question is, is there a way to get the name of a subpatch from within it, besides using javascript?
    Here is an example patch of what i'm working on:

    • Jan 04 2008 | 6:37 am
      evan.raskob [lists] schrieb: > My question is, is there a way to get the name of a subpatch from within > it, besides using javascript?
      only javascript, including the rectangle of the patcher, save as myname.js and bang it...
      outlets = 2; setoutletassist(0,"my scripting name (list)"); setoutletassist(1,"my rect (list)");
      function bang() { if(this.patcher.box){ outlet(0, this.patcher.box.varname); outlet(1, this.patcher.box.rect); } }
      here is the help file:
      -- Stefan Tiedje------------x------- --_____-----------|-------------- --(_|_ ----|-----|-----()------- -- _|_)----|-----()-------------- ----------()--------www.ccmix.com
    • Jan 04 2008 | 10:02 am
      On 4 janv. 08, at 07:37, Stefan Tiedje wrote:
      > outlets = 2; > setoutletassist(0,"my scripting name (list)"); > setoutletassist(1,"my rect (list)"); > > function bang() > { > if(this.patcher.box){ > outlet(0, this.patcher.box.varname); > outlet(1, this.patcher.box.rect); > } > }
      If I may, I would suggest swapping the 2 outlets calls, so it outputs from the right to the left, like what you generally expect in a standard Max object.
      function bang() { if(this.patcher.box){ outlet(1, this.patcher.box.rect); // output first to the right outlet outlet(0, this.patcher.box.varname); // then to the left } }
      Cheers, ej
    • Jan 04 2008 | 10:48 am
      yeah, I was hoping to avoid js, though, because I might want to create large numbers of subpatches and a compile C external would be better suited, me thinks.
      Thanks for the handy script, anyway! I'll use it for now.
      Funny, but now I finally understand why you want a "pattrbackward", Stefan. I never understood what it would be useful for until now.
      Here's my feature reuest: it would be nice if thispatcher could output the scripting name of a patcher it was inside. I'm actually surprised that it can't - it can do everything else. (Unless I am missing something)
      Cheers Evan
      On Jan 4, 2008, at 10:02 AM, Emmanuel Jourdan wrote:
      > On 4 janv. 08, at 07:37, Stefan Tiedje wrote: > >> outlets = 2; >> setoutletassist(0,"my scripting name (list)"); >> setoutletassist(1,"my rect (list)"); >> >> function bang() >> { >> if(this.patcher.box){ >> outlet(0, this.patcher.box.varname); >> outlet(1, this.patcher.box.rect); >> } >> } > > > If I may, I would suggest swapping the 2 outlets calls, so it > outputs from the right to the left, like what you generally expect > in a standard Max object. > > function bang() > { > if(this.patcher.box){ > outlet(1, this.patcher.box.rect); // output first to the > right outlet > outlet(0, this.patcher.box.varname); // then to the left > } > } > > Cheers, > ej > >
    • Jan 05 2008 | 11:25 am
      Emmanuel Jourdan schrieb: > If I may, I would suggest swapping the 2 outlets calls, so it outputs > from the right to the left, like what you generally expect in a standard > Max object.
      You may, thanks a lot, I am still a js newbie... ;-)
      Stefan
      -- Stefan Tiedje------------x------- --_____-----------|-------------- --(_|_ ----|-----|-----()------- -- _|_)----|-----()-------------- ----------()--------www.ccmix.com
    • Jan 05 2008 | 1:14 pm
      Hi Evan, I made you an external that outputs the name of its containing subpatcher:
      Let me know if it works.
      Cheers, Mattijs
    • Jan 05 2008 | 2:56 pm
      Brilliant! Thanks for that.
      Just one oddity, though - it outputs the name (left outlet) before the right outlet (index). Keeping with max standards, this should be reversed, no?
      Best Evan
      On Jan 5, 2008, at 1:14 PM, Mattijs Kneppers wrote:
      > > Hi Evan, I made you an external that outputs the name of its > containing subpatcher: > > http://arttech.nl/scriptname.zip > > Let me know if it works. > > Cheers, > Mattijs > -- > SmadSteck - http://www.smadsteck.nl > Hard- and software for interactive audiovisual sampling
    • Jan 05 2008 | 4:35 pm
      Haha, same mistake as Stefan! Don't we ever learn?
      I updated it, same link.
      Mattijs