Add elements to message from another message box

ward de jager's icon

In pure data we can construct longer messages with message boxes

Forr example add2 : will add another number without terminating comma

Addcomma : will add a comma etc..

Addsemi : add semicolumn

Adddollar etc...

I know max messages accept prepend and append messages but I can't seem to add commas or semicolumns


Source Audio's icon

In word one can do it even easier...

joke aside, max treats some chars different than the others,

and uses append message to insert items into message

and some other objects.

Have a look in help and reference of message object

adding comma using \, is ok, but adding semicolon into a message will give you

a trouble.

unless you want to use it as sender of messages.

Roman Thilenius's icon

i believe in order to add commas to messageboxes you would know what message you want to add the comma to.

the best way to recreate the pd behaviour to a messagebox is probably to use scripting, and delete/recreate the messagebox in question.

the messagebox itself is never the best solution for that of thing. [coll] works almost ike a messagebox for storing and retreivign data, and you do not have to care about "commas", since they are already contained in it. in addition to append and prepend coll would also offer insert or delete at position and can share its content across the runtime.

Source Audio's icon

coll is not good idea whan one wants to insert commas or semicolons.

They are fixed part of coll syntax.

if you need commas just to iter output, then use iter.

Roman Thilenius's icon

with coll you wont need commas though :)

the "addcomma" message in pd concatenates it with an already stored item.

of course coll and zl.nth have tha disadvantage that you have to take care about lists vs symbols yourself. that´s the only things message it good at, it lets you type what you want.

Nodanoma's icon

Hi Ward,

perhaps tell us what it is you want to achieve or replicate exactly (i.e. what to use the message box with its items for). There are many ways in Max to achieve something like this in a slick fashion, depending on your purpose and how well you know you way around. Besides, messages are not eas easily edited later, especially when they contain commas (i.e. different iterated items). So objects from the array-family or the zl-objects (for instance: zl queue) can help. or, as mentioned above, simply iter.

ward de jager's icon

It's true that the use case of altering the content of a message box is not so common , but sometimes it's needed .

Atm not working on something that needs , I was just curious how it was done in Max

Source Audio's icon

if you only want to display text, then use comment.

message is something else, it also executes

stuff, and so behaves differently.

and it is not uncommon at all to alter message contents.

ward de jager's icon

I am well aware of all that ;)