get patcher name (again)

gusanomaxlist's icon

Hi.
1st of all, sorry if this sounds very easy and stupid to you but these are my very first steps into JS.

I'm trying to get a bpatcher scripting name from inside of it.
I've searched on the javascript list and tried different scripts but can't get it working.
Now I have a really simple js and I place it inside a named bpatcher and I only get when I ask for his scriptname.
If someone could have a look at the following example...
(I also have the js inside a patcher to compare)

____________________________________
getname.js

function bang()
{
    post(this.patcher.varname);
}

____________________________________
testgetname.pat

Max Patch
Copy patch and select New From Clipboard in Max.

____________________________________
main patcher

Max Patch
Copy patch and select New From Clipboard in Max.

Thanx.

jln's icon
Mattijs's icon

That should be

function bang()
{
    post(this.patcher.box.varname);
}

Check it out in javascriptinmax.pdf, the varname property belongs to Maxobj, not to Patcher

hth,
Mattijs

gusanomaxlist's icon

ach sooo !
I should sleep a little bit more before trying to understand this javascriptinmax.pdf :)
Many thanx to both of you !
Cheers.