14 March 2011

Max/MSP Javascript "find object" - lazy dollar function

The second function in my "Making Max JS less crap" series, this function scans all objects in the patch and all subpatches and returns a reference to the object with the specified scripting name: It's basically a lazy man's version of my dollar function which means you dont need to give every patcher a scripting name. The downside is it (probably) runs a bit slower. Enjoy!

Please see right hand pane before copying my code>>

function _$(id){ //search through all max objects:
    tempobj=0
    tempname=id
    this.patcher.applydeepif (_$act,_$scan);
    delete tempname
    return(tempobj)
}
function _$act(obj){
    tempobj=obj
}
function _$scan(obj){
    if(obj.varname==tempname){
        return(true)
    }else{
        return(false)
    }
}

//USAGE:
_$("myButton").message('set','new text!') //find the first object anywhere in the project that has scripting name myButton and send it a message.

7 comments:

Unknown said...

ralph lauren outlet
true religion outlet
jordan shoes
coach outlet
ugg outlet
nike air force 1
canada goose sale
gucci handbags
nike shoes
kevin durant shoes
20161228caiyan

Unknown said...

20180623xiaoke
polo ralph lauren outlet
air max 2018
cheap jordans
canada goose jackets
coach outlet store online
dsquared2 jeans
cheap jordan shoes
oakley sunglasses wholesale
michael kors outlet clearance
coach outlet store online

Anbarasan14 said...

Thanks for sharing this information with us. The content was helpful to many of the readers.
Spoken English Classes in Anna Nagar
Spoken English Classes in Porur
Spoken English Class in Kodambakkam
Spoken English Class in Adyar
Best Spoken English Classes in Chennai
IELTS Coaching Centre in Chennai
Spoken English Classes in Mumbai
English Speaking Course in Mumbai
IELTS Coaching in Mumbai
IELTS Mumbai

Tamil Typing said...

Looking for best Tamil typing tool online, make use of our Tamil Virtual keyboard online to type in Tamil on web browser and share it on your social media handle. Tamil Typing Software Download

Pradeep Appslure said...

We are amongst the Best Mobile App Development Company in Mumbai that offer IOS, Android Mobile Application Development services that look Great and act Smart.
Mobile app development company in mumbai

Pradeep Appslure said...

Mobile App Development Company Delhi: We have the Top iPhone Android app developers team, offering custom mobile app development Services in Delhi.
mobile app development company in delhi

Tekniko Global said...

mobile app development company in delhi

Post a Comment

Cron Design Studio: Dublin based web design & software development