is it possible to read the varname of an object that sends a message to a js object

Jun 16, 2009 at 8:01pm

is it possible to read the varname of an object that sends a message to a js object

the title is my question Smile
i started to post this question in the general forum – but i think it belongs to this one.

i attached a patch to illustrate what i mean. in the original scripts i have a huge amount of ubuttons, that dynamically connect to other object. is it possible for a js (or any other object)which object is sending a message?

thanks for any reply!


Jun 16, 2009 at 10:59pm

meanwhile i found a solution for my patch: if i use the jsui instead of the ubuttons.
but nevertheless i think it is an interesting question as this seems to be a very basic information max needs to generate in order to make a patch run.
but is this information via api accessible?

so still happy for suggestions. Smile


Jun 17, 2009 at 10:09am


i havn’t find an easy way to do it (with javascript), but a roundabout : yes ! Wink

Jun 17, 2009 at 11:49am

Thats clever, I would never have thought of using the “ignoreclick” property! Here’s a modification that checks the varname attribute using a regular expression. This means that including another [button] in your patch that is click enabled (with or without a scripting name) will not break the result.


var result;
var pattern = /^b[d+]$/;

function bang() {
    post ("go!n");

function whois() {
    result = "no";
    this.patcher.apply (find_bang);
    outlet (0, result);

function find_bang(a) {
    if (a.maxclass == "button" && !a.ignoreclick && pattern.test(a.varname)) {
        result = a.varname ;
    return true;
Jun 17, 2009 at 4:20pm

Hello maxers,

nice add, therishopeforus ;
to be honest, i wanted to use “color” property of object, but i didn’t found how to. Anyway, the best way to do the job is to read the number in the box, isn’t it ?!

Jun 17, 2009 at 10:59pm

Thanks for all your contributions!



You must be logged in to reply to this topic.