14 March 2011

Max/MSP Javascript: Dollar Function - Returns a reference to a Max Object in a patch/subpatch

I started using Max this month and was simultaneously impressed with its power and simplicity and frustrated by it's cumbersome interface. I quickly checked out it's javascript capabilities and became much more comfortable. JS allows you do simple operations quite quickly that would take a tonne of parsing objects which use up space and lead to a messy patch.

That said, JS in Max is really a slightly ugly cousin of browser based javascript. Calls to objects are long winded and basically everything is a bit head wrecking!

So here we go: the first in my "Making Max JS less crap" series... The infamous dollar function! All you need to do to access a max object is give the object a scripting name in the inspector* and then use: $('scriptingname')

Please see right hand pane before copying my code>>

function $(stringref){
    stringref=stringref.replace(/parent/gi, "parentpatcher")
    var path=stringref.split('.')
    var obj=this.patcher
    for(i in path){
        if(path[i]=='parentpatcher'){ //up 1 level:
            obj=obj.parentpatcher
        }else{
            obj=obj.getnamed(path[i])
            if(i!=path.length-1){ //down 1 level:
                obj=obj.subpatcher()
            }
        }
    }
    return(obj)
}


//USAGE:
$("myButton").message('set','new text!') //access 'myButton' object in current patcher
$("parent.myButton").message('set','new text!') //access 'myButton' object in parent patcher
$("myPatcher.myButton").message('set','new text!') //access 'myButton' object in child patcher
$("parent.myPatcher.myButton").message('set','new text!') //access 'myButton' object in sibling patcher

* If you're not bothered giving every patcher a unique scripting name in the inspector, try my lazy dollar function instead.

UPDATE:
A good way to use this function is to use Luke Hall's include script. Save his script into your jsexternals folder, save my functions into your project folder as basefunctions.js (or something similar) and then you can simply use include(this,"basefunctions.js") at the top of every JS file you use. Thanks Luke - this is awesome!


246 comments:

«Oldest   ‹Older   201 – 246 of 246
sathishkumar said...

Thanks for sharing such nice info. I hope you will share more information like this. please keep on sharing!

Python Training In Bangalore | Python Online Training

Artificial Intelligence Training In Bangalore | Artificial Intelligence Online Training

Data Science Training In Bangalore | Data Science Online Training

Machine Learning Training In Bangalore | Machine Learning Online Training

AWS Training In Bangalore | AWS Online Training

IoT Training In Bangalore | IoT Online Training

Adobe Experience Manager (AEM) Training In Bangalore | Adobe Experience Manager (AEM) Online Training

Oracle Apex Training In Bangalore | Oracle Apex Online Training

aveesha said...

nice Post thanks for the information, good information & very helpful for others.
Looker Training

Aishwariya said...

It's an excellent article!!! Such a piece of wonderful information and I was getting more concept to your blog. Thanks for your great explanations.
AWS certification course in Chennai

Michael L Catudal said...

เราคือผู้นำด้านเกมพนันออนไลน์ Major168 เราคือผู้ให้บริการ คาสิโนออนไลน์ ที่ได้รับรองว่าดีที่สุดในประเทศไทย มีค่ายเกมส์ให้เล่นมากมาย Sagaming, Sexy bacarat, Dreamgame, Ebet, Wm casino, Vivo gaming ไม่ผ่านเอเย่นต์ ระบบปลอดภัยมีทีมงานดูแลตลอด 24ชม.

SAGAME88 แหล่งรวมเกมส์พนันออนไลน์ คาสิโนสด บาคาร่า กำถั่ว คาสิโนออนไลน์ ไฮโล รูเล็ต รับเครดิตฟรีเล่นได้ทุกเกมส์ โบนัสสมาชิกใหม่เพียบ พร้อมระบบฝากถอนออโต้ 10วิ เรามีทุกค่ายเกมส์ให้คุณเลือกเดิมพัน SA Game Sexy bacarat Dreamgame WM Casino VIVO Gaming Ebet เล่นได้ทุกเกมส์

Our website ufabet provides betting services in the system of Auto Deposit-Withdrawal. Our members are not only in Thailand. Online football betting UEFA Bet market And this makes a guarantee that Ufabet168 is another reliable football betting website

ufa through the website UFABET1688 a web gambling online , one that integrated all the bets from online casinos , online casino , online , and also have a game a lot more to be chosen to play such games.

Scottishkilt said...

Great article! This is the type of information that are meant to
be shared across the internet. Thank you for sharing such a useful post. Very Interesting Post! I regularly follow this kind of Blog.

Tweed Kilt Jackets

Alexander Debrah said...

All access to ufabet direct website, not through agents Come to here, the only place in the world, the center for direct access to UFABET. All links, a complete approach to UEFA Bet Whether it is UFABET live casino online 1 day that you all gamblers have been using the service for a long time.

nayar said...

Awesome blog. Thanks for sharing such a worthy information....
Data Science Courses in Bangalore
Data science course in Pune
Data science course in hyderabad
Data science course in delhi

jbmglobal said...

I'm impressed, I must say. Very rarely do I come across a blog that's both informative and entertaining, and let me tell you, you've done a great job by providing this information to the users.
Best School In Noida

smartstart said...

I would like to thank you for the efforts you have made in writing this article. Hope to see some great stuff in the future as well.
Top play schools in noida

steppingstone said...

I just stumbled upon your blog and it was great to be here! Definitely, this is a great post with great content
Website- Visit Website

vé máy bay đi Canada said...

Đặt vé máy bay tại Aivivu, tham khảo

vé máy bay đi Mỹ bao nhiêu tiền

chuyến bay từ mỹ về việt nam covid

vé máy bay từ canada về việt nam giá rẻ

đặt vé máy bay từ nhật về việt nam

vé máy bay từ hàn về Việt Nam

Vé máy bay từ Đài Loan về Việt Nam

BİLAL HAN said...

rastgele görüntülü konuşma - kredi hesaplama - instagram video indir - instagram takipçi satın al - instagram takipçi satın al - tiktok takipçi satın al - instagram takipçi satın al - instagram beğeni satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - binance güvenilir mi - binance güvenilir mi - binance güvenilir mi - binance güvenilir mi - instagram beğeni satın al - instagram beğeni satın al - polen filtresi - google haritalara yer ekleme - btcturk güvenilir mi - binance hesap açma - kuşadası kiralık villa - tiktok izlenme satın al - instagram takipçi satın al - sms onay - paribu sahibi - binance sahibi - btcturk sahibi - paribu ne zaman kuruldu - binance ne zaman kuruldu - btcturk ne zaman kuruldu - youtube izlenme satın al - torrent oyun - google haritalara yer ekleme - altyapısız internet - bedava internet - no deposit bonus forex - erkek spor ayakkabı - webturkey.net - karfiltre.com - tiktok jeton hilesi - tiktok beğeni satın al - microsoft word indir - misli indir

salome said...

very informative article.keep up the good workAngular training in Chennai

aveesha said...

Great post. MuleSoft Training in Canada is a best institute for training.

Unknown said...

youtube abone satın al
trendyol indirim kodu
cami avizesi
cami avizeleri
avize cami
no deposit bonus forex 2021
takipçi satın al
takipçi satın al
takipçi satın al
takipcialdim.com/tiktok-takipci-satin-al/
instagram beğeni satın al
instagram beğeni satın al
btcturk
tiktok izlenme satın al
sms onay
youtube izlenme satın al
no deposit bonus forex 2021
tiktok jeton hilesi
tiktok beğeni satın al
binance
takipçi satın al
uc satın al
sms onay
sms onay
tiktok takipçi satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
instagram beğeni satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
takipcialdim.com/instagram-begeni-satin-al/
perde modelleri
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
betboo
marsbahis
sultanbet

Unknown said...

instagram takipçi satın al
ucuz takipçi
takipçi satın al
https://takipcikenti.com
https://ucsatinal.org
instagram takipçi satın al
https://perdemodelleri.org
https://yazanadam.com
instagram takipçi satın al
balon perdeler
petek üstü perde
mutfak tül modelleri
kısa perde modelleri
fon perde modelleri
tül perde modelleri
https://atakanmedya.com
https://fatihmedya.com
https://smmpaketleri.com
https://takipcialdim.com
https://yazanadam.com
yasaklı sitelere giriş
aşk kitapları
yabancı şarkılar
sigorta sorgula
https://cozumlec.com
word indir ücretsiz
tiktok jeton hilesi
rastgele görüntülü sohbet
erkek spor ayakkabı
fitness moves
gym workouts
https://marsbahiscasino.org
http://4mcafee.com
http://paydayloansonlineare.com

data science said...

Great to become visiting your weblog once more, it has been a very long time for me. Pleasantly this article i've been sat tight fosuch a long time. I will require this post to add up to my task in the school, and it has identical subject along with your review. Much appreciated, great offer. data science course in nagpur

shakunthala said...

thanks for sharing this article with us
full stack developer course
full stack developer course in Bangalore

Chartered Accountants in Bangalore said...

https://salsabeelahmedandco.com/
Very Informative and useful... Keep it up the great work. I really appreciate your post.

https://salsabeelahmedandco.com/company-registration-in-bangalore/
https://salsabeelahmedandco.com/ca-firms-in-bangalore/
https://salsabeelahmedandco.com/accounting-services-in-bangalore/
https://salsabeelahmedandco.com/gst-consultants-in-bangalore/
https://salsabeelahmedandco.com/public-limited-company/
https://salsabeelahmedandco.com/private-limited-company-in-india/
https://salsabeelahmedandco.com/one-person-company-in-india/
https://salsabeelahmedandco.com/partnership-firm-in-bangalore/
https://salsabeelahmedandco.com/limited-liability-partnership-llp/

Unknown said...

www.escortsmate.com
escortsmate.com
https://www.escortsmate.com

Priya Rathod said...

How fascinating it is to visit your website. What useful information you offer here. This will help me a lot with my project.
AWS Training in Hyderabad
AWS Course in Hyderabad

Priya Rathod said...

Thank you for sharing your post and please keep me informed with more posts. I was searching for such articles like this through long time, today i found it at last. It helps me a lot, really.
Data Science Training in Hyderabad
Data Science Course in Hyderabad

sam said...

We are most trusted chevy dealership peoria il, where you can find new or used Chevrolet models.
Visit here - Chevy Dealership Peoria Il

Sattamatka said...

Nice to be visiting your blog. satta matka, kalyan matka number, matka result, kalyan main matka tips
For More Details - Matka Result

Tamil novels said...

Fantastic blog. Thanks for sharing with us.
Tamil novels pdf download
Ramanichandran novels PDF
srikala novels PDF
Mallika manivannan novels PDF
muthulakshmi raghavan novels PDF
Infaa Alocious Novels PDF
N Seethalakshmi Novels PDF
Sashi Murali Tamil Novels PDF

Sam said...

I found your blog recently and have been following along. I thought I'd leave my first comment. Looking for the Best Driving School Coquitlam? Mountain Driving Academy is a certified driving school.
Visit Best Driving School Coquitlam

seo freelancer in bangalore said...

Thanks for the post.
SEO Freelancer in Bangalore ,naveedadigital.com offers best SEO freelancing services
in Bangalore for all kinds of businesses.

https://naveedadigital.com/
https://naveedadigital.com/digital-marketing-freelancer-in-bangalore/
https://naveedadigital.com/social-media-marketing-freelancer-in-bangalore/

moreinfows said...

Great I really like your post. Such amazing information, all the best for more updates. Thanks for sharing. It is such a very amazing post.
nagaland dear lottery

Unknown said...

Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for
Blue star AC repair center in Nagpur

Reshma said...

Wonderful blog.Thanks for sharing such a worthy information...
Python Training in Hyderabad
Python Classes in Gurgaon

werwer said...

Wifi Password hacker is totally 100 % free. You'll access to any device that is with the range. Also, It is a direct process you have to activate it. It’ launch hunting each of the tools around you and automatically connects you to definitely the device as stated by your selection. https://freeprosoftz.com/wifi-password-hacker/

Unknown said...

seo fiyatları
saç ekimi
dedektör
instagram takipçi satın al
ankara evden eve nakliyat
fantezi iç giyim
sosyal medya yönetimi
mobil ödeme bozdurma
kripto para nasıl alınır

johnss23 said...

I really like your site it’s very impressive. Thanks for the inspiration! I really appreciate people like you!
Click here: Smoking Jackets

Rodosq said...

İnstagram takipçi satın al! İnstagram takipçi sitesi ile takipçi satın al sende sosyal medyada fenomen olmaya bir adım at. Sende hemen instagram takipçi satın almak istiyorsan tıkla:

1- takipçi satın al

2- takipçi satın al

3- takipçi satın al

Sris Law said...

This article shares really good content. Very nice to read the article. Keep updating.
Immigration Lawyer Near Me Virginia
Personal Injury Lawyers Near Me Virginia
Bankruptcy Attorney Near Me Virginia

Customer Service said...

Thank You for Providing Such insightful information. If someone is looking for the Quickbooks customer service in US.

mark said...

click here

Unknown said...

kartal alarko carrier klima servisi
çekmeköy mitsubishi klima servisi
ataşehir mitsubishi klima servisi
beykoz arçelik klima servisi
üsküdar arçelik klima servisi
pendik samsung klima servisi
pendik mitsubishi klima servisi
tuzla vestel klima servisi
tuzla bosch klima servisi

SrisLawyers said...

I Like your post. It gives us more information.
Sex Crimes Lawyer VA
woman owned small business
divorce law in virginia

ligaz77king said...

Excellent post it is very helpful and knowledgeable content good work keep it up. ทางเข้าเล่น joker

ravise23 said...

Thanks for sharing
Website :- nid courses

sportsbet said...

Good content. You write beautiful things.
mrbahis
hacklink
vbet
sportsbet
mrbahis
hacklink
taksi
vbet
korsan taksi

GwayERP software said...

It’s really a cool and helpful piece of information. I am glad that you shared this useful information with us. Please keep us up to date like this. Thanks for sharing.customized erp in Chennai. I don’t know what I would have done if I had not encountered such a step like this.

ravise23 said...

This is a great inspiring article.I am pretty much pleased with your good work.
Visit here :- uceed paper pattern

Torz said...

elf bar
binance hesap açma
sms onay
SBYV

LilZey said...

betmatik
kralbet
betpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
KHXYCZ

«Oldest ‹Older   201 – 246 of 246   Newer› Newest»

Post a Comment

Cron Design Studio: Dublin based web design & software development