[PD] Get name of patch from within the patch

Kaj Ailomaa zequence at mousike.me
Tue Mar 4 09:00:36 CET 2014

On Tue, Mar 4, 2014, at 02:54 AM, Chris McCormick wrote:
> Hello,
> On 03/03/14 21:55, Kaj Ailomaa wrote:
> > Hi. I've been googling a bit and looking through the library of objects
> > that comes with pd-extended, but can't seem to find a way to get the
> > name of the patch from within the patch. Anyone know of a nice method to
> > do this?
> I would use [namecanvas] for this. For example you could have an object
> like [namecanvas $0-mypatch] and then you can send messages to the patch
> using e.g. [s $0-mypatch].

Thanks, but this won't work for me, as the name has to be the actual
patch name.

I've understood that there might be a fix in the svn version of
[canvasname], apart of iemguts, which would allow getting the name of
the top level patch.

The reason I had for this is I wanted to have uniquely named patches
that have a common save mechanism, which looks up the savefile based on
the unique patch name.
I was always going to create these uniquely named patches in another top
level patch, so I can get around this problems by adding an argument for
the patch, which is the same as the patchname, and let the save
mechanism look up the filename that way.

I initially would have wanted the uniquely named patch to be able to be
opened as is, but that's not a major problem.

More information about the Pd-list mailing list