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

May 9, 2009 at 12:48am

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

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!

#43741
May 9, 2009 at 12:41pm

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.

#157081
May 9, 2009 at 6:18pm

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

#157082
May 9, 2009 at 7:47pm

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. –
#157083
May 10, 2009 at 8:23am

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

#157084
May 13, 2009 at 7:19pm

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.

#157085

You must be logged in to reply to this topic.