Forums > MaxMSP

scripting query

September 26, 2007 | 3:29 pm

hi

is there a scripting command to select/delete only named objects of a perticular type? ie, could I say something like, "delete only outlets with names", or even "how many outlets with names are there?". failing that, is there a command for reporting how many of a particular object are in a patch, named or not?

thanks

robin


September 26, 2007 | 4:11 pm

On 26 sept. 07, at 17:29, robin foster wrote:

> is there a scripting command to select/delete only named objects of
> a perticular type? ie, could I say something like, "delete only
> outlets with names", or even "how many outlets with names are
> there?". failing that, is there a command for reporting how many of
> a particular object are in a patch, named or not?

For that kind of stuff you need to go JavaScript. There’s a
this.patcher.apply() method which allows you to iterate through all
the objects in your patch. Then you can access to the property of
each objects (in your case, maxclass and varname). Have a look to the
JavaScriptInMax.pdf document. There’s also a nice example of patch
iteration (patchdescribe-example.pat in the examples/Javascript/
patcher-scripting folder).

HTH,
ej


September 26, 2007 | 4:15 pm

lovely, thanks
well, probably not lovely at all, but thanks still!


October 1, 2007 | 8:13 am

robin foster schrieb:
> is there a scripting command to select/delete only named objects of a
> perticular type? ie, could I say something like, "delete only outlets
> with names", or even "how many outlets with names are there?".
> failing that, is there a command for reporting how many of a
> particular object are in a patch, named or not?

Within Javascript I guess, but if you give names with numbers to the
objects, you can easily construct something even more convenient with a
combination of uzi and sprinf…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


October 1, 2007 | 11:51 am

that’s what i’ve got. the patch allows the user to create x number of objects as required, and my problem was how to let uzi know how many were currently in the patch, so as not to fill the max window with error messages. i’ve solved it now, i was just being a bit dense and using peak to track the highest number created rather than just taking the last value recieved.


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