Forums > MaxMSP

is there a way to generate a list the names of all receive~ objects that are present?

May 9, 2009 | 12:48 am

I’d like automatically fill a umenu with the names of all the different receive~ objects that are present in my patch. This will be used to assign send~ objects accordingly. Any ideas?

Thanks in advance!


May 9, 2009 | 12:41 pm

Look into javascript. A starting point: iterating through all objects in a patch with the example "patchdescribe-example.maxpat" (in Max examples / Javascript ). You might get more lucky by asking on the "javascript" forum.
J-F.


May 9, 2009 | 6:18 pm

Unfortunately I don’t think it is possible to get the names associated with [send~] and [receive~] objects using javascript. The only work around I can think of is loading in the patch as JSON and searching for the names that way. This method obviously isn’t perfect and will only work when the file is saved as a maxpat.

lh


May 9, 2009 | 7:47 pm

Here’s one way that works as long as it remains saved as a maxpat. Complications will arise if you want to turn it into a collective or standalone.

First load the code in the comment box into the [js] object then save the patch to disc somewhere. Now trigger the [loadbang] and have a look in the [umenu]. Try deleting and creating some more [receive~] objects and saving your patch. If you look again in the [umenu] the contents should be updated automatically. You could probably write a javascript file to do all of this automatically when dropped into a patch. I hope it helps.

lh

– Pasted Max Patch, click to expand. –

May 10, 2009 | 8:23 am

interesting — thanks. I’ll check this out tomorrow!


May 13, 2009 | 7:19 pm

robb drinkwater (the man, the myth, the legend) yesterday mentioned another smart way to achieve dynamic send and receive assignments: build modules such that the receive objects report their names to a shared coll when instantiated; then fill a menu from that coll and use that to set the names of your sends. not bad! Add a little #0 in there and the possibilities are wide open.


Viewing 6 posts - 1 through 6 (of 6 total)