Forums > MaxMSP

Simple question about lists and writing text files

March 4, 2012 | 5:16 pm

Hi all,
i have started with max today and i am wondering:
1 – How to Append Elements to a Message Box (for example i have a message button in which is written ‘a’ and i want that everytime i press this button it appends a in the new message button, so after i press 5 times this button i have in the new message box ‘a a a a a’.

2 – How to print on a text file the text of a message box.

Thanks


March 4, 2012 | 5:40 pm

For 1 take a look at : join and zl objects
For 2 : coll


March 5, 2012 | 8:09 am

Thank you for your reply.. i tried to do what is in the attached image file but it will not prepend nothing just set a new message…
I want that everytime i click on a it will add another a so if message box is 'a' after i click another time 'a' must be 'a a'.

How possible?

thanks

[attachment=187219,3480]

Attachments:
  1. corrmax.JPG

March 5, 2012 | 12:03 pm

The messageobject has 2 inlets, and they work differently (true for almost all objects) Most important: the leftmost inlet sets a value and sends it out immediatly (hot inlet in the max language, in opposite to cold inlet, in general the rightmost inlet). The messagebox is little different: when you connect the leftmost inlet, nothing ist set, if you connect left inlet message is set, but nothing sent out. Therefore the prepend instruction SET, connectet to the messagebox, will constrain the messagebox to actually set the message: in your case only that message coming in ABOVE the PREPEND object, so if you wanted to prepend again is after the message created (this is a basic but very helpfull exemple to understand what I would call the chain of instruction or instanciation: is important to understand to get what you want. The solution of your issue is more tricky: check sprintf


March 5, 2012 | 12:52 pm

i cannot understand still… I just need message box called ‘a’ and everytime i press on it it must add another ‘a’ in a new message box.
It is the simple prepend function of LISP applied to list.
Is not possible using prepend???


March 5, 2012 | 9:58 pm

is this what you are looking for?

– Pasted Max Patch, click to expand. –

March 6, 2012 | 1:06 am

also, please spend more than a day doing the max tutorials before trying to implement LISP functions ;)


March 6, 2012 | 1:24 am

Or just use LISP:

http://music.columbia.edu/~brad/maxlispj/

brad

http://music.columbia.edu/~brad



o s
March 6, 2012 | 8:06 am

is there a command ‘prepend’ in lisp? I only know ‘cons’…?

ole


March 6, 2012 | 11:44 am

I made these "zl append" and "zl prepend" abstractions a while ago, and I use them quite often :

– Pasted Max Patch, click to expand. –

March 8, 2012 | 11:09 pm

@Guillaume Bertrand
@grizzle

Yes your example were perfect Thank you a lot.
Also i will try to see that Max Lisp :)


March 9, 2012 | 6:00 am
– Pasted Max Patch, click to expand. –

March 11, 2012 | 10:52 am

thanks christopher :)


March 13, 2012 | 3:10 pm

or use zl group. only on object ;-)

– Pasted Max Patch, click to expand. –

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