Scripting new message boxes including spaces

pdelges's icon

pdelges

2月 12 2024 | 12:35 午後

I try to create (scripting with [thispatcher]) a new message in a patch.

This worked fine in an old patch of mine, using "script new…" but it seems that I can't add presentation attributes this way.

So I switched to "script newobject…", but I discovered that succession of spaces in the messages were replaced by one single space.

Any idea to create a message box with a text including many spaces, like "a badly named file", visible in presentation mode?

The following patch will probably explain better what I mean:

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

Source Audio

2月 12 2024 | 2:22 午後

Max Patch
Copy patch and select New From Clipboard in Max.

maybe this could work

Roman Thilenius's icon

Roman Thilenius

2月 12 2024 | 2:25 午後

i´ve only tried with max v7 (and not with v4 OSX, when newobject was introduced), but it might be that it has always been like that(and now follows two assumptions...):

- since the newobject command exists, only the new command is to be used for GUI objects.

- if you try to newobject a message, this is basically like writing "message" into an object box. this way the GUI object can be called, but the symbol of the attribute gets lost/broken.

proof of the above hypothesis:

1. it´ll work fine with abstractions.


2. if you type this into an objectbox manually, which then transforms into an GUI object, it also will destroy the spaces (and keeps working otherwise), just as with scripting.

so it has nothing to do with thispatcher scripting itself.

pdelges's icon

pdelges

2月 12 2024 | 2:54 午後

Many thanks to both of you.

For the workaround and the explanations, which make sense.

@Source Audio, I have no time now to investigate much, but it looks like the message box' size may be different using new or newobject.

To get the best of both functions, I may finally use something like :

script new $2 message 400 250 130 196617 $1, script send $2 presentation 1, script send $2 presentation_rect 500 250 140 21