Forums > MaxMSP

Name variables with scripting

Nov 21 2007 | 7:57 pm

Hi, I am trying to make it possible to load an abstraction which once loaded is automatically connected to a hslider.

The problem is that I cannot figure out a way of automatically naming the abstraction as a variable. This means that when thispatcher receives the message connect var1 0 sliderstereo 2, it cannot do this as the abstraction is not yet named, I understand that thisobject is only operational when used in an inspector patch, but cannot figure out another way of naming the abstraction autmoatically,

I have no javascript knowledge but would be willing to learn.

Many thanks, Ed

Included in the attachment is the abstraction ‘sliderstereo’ and a test patch to attempt to make it work.

Nov 22 2007 | 7:43 pm

Moving this topic from the archives to MaxMSP


Nov 22 2007 | 10:28 pm

I could be confused about what you are trying to achieve but try this:

Take all the scripting & thisobject stuff out of the stereoslider abstraction you don’t need it.

save the abstraction where max can find it (externals folder)

send this message to thispatcher:

‘newex 29 118 65 196617 sliderstereo, objectname frank’

This creates a new ‘sliderstereo’ and names it ‘frank’

is that what you wanted?


Nov 23 2007 | 12:41 am

That’s exactly what i needed, thanks very much for your help, that has been driving me mad for a while. How can i learn things like that, is there a tutorial concerning scripting that you can recomend? thanks again, Ed

Nov 23 2007 | 1:04 am

most of the ‘thispatcher’ scripting messages are explained in the Max Reference Manual. But a good tip i picked up on these forums is that you can open a saved max patch as text (from the max’s file menu) and look at the scripting for the creation of each object. Very similar syntax is used to control thispatcher so often the relevant bits can be copied into your patch.

So to work out the solution to your problem i created a ‘sliderstereo’ abstraction and manually named it ‘frank’ i then saved the patch and re-opened it as text.

It looks like this:

max v2;
#N vpatcher 304 44 904 444;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 28 143 65 196617 sliderstereo;
#P objectname frank;
#P pop;

It’s pretty easy to spot the bit that creates the object, and the following line that names the object. From there it took a experimentation to work out how to combine the two lines into a working message to ‘thispatcher’

best of luck,


Viewing 5 posts - 1 through 5 (of 5 total)

Forums > MaxMSP