get patcher name (again)

Jul 17, 2007 at 12:28pm

get patcher name (again)

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

#P button 36 36 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 36 68 54 9109513 js getname;
#P connect 1 0 0 0;
#P window clipboard copycount 2;

____________________________________
main patcher

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 39 284 188 448;
#P button 36 58 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 36 87 54 9109513 js getname;
#P connect 1 0 0 0;
#P pop;
#P newobj 212 252 36 9109513 p none;
#P objectname wow;
#P bpatcher 105 93 100 100 0 0 testgetname.pat 1;
#P objectname blah;
#P window linecount 3;
#P comment 257 252 100 9109513 this patcher is also named and it also doesn’t work;
#P window clipboard copycount 3;

Thanx.

#32918
Jul 17, 2007 at 1:02pm

#108992
Jul 17, 2007 at 1:05pm

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

#108993
Jul 17, 2007 at 1:20pm

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

#108994

You must be logged in to reply to this topic.