Simple question about lists and writing text files
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
For 1 take a look at : join and zl objects
For 2 : coll
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
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???
is this what you are looking for?
also, please spend more than a day doing the max tutorials before trying to implement LISP functions ;)
is there a command 'prepend' in lisp? I only know 'cons'...?
ole
I made these "zl append" and "zl prepend" abstractions a while ago, and I use them quite often :
@Guillaume Bertrand
@grizzle
Yes your example were perfect Thank you a lot.
Also i will try to see that Max Lisp :)
thanks christopher :)
or use zl group. only on object ;-)