how to send an empty string?
Hi all,
how can I have an object that sends out an empty string?
If I put "" in a messagebox it works first: although the "" dissappears, an empty string is sent on bang.
However, on reopening the patch the message box is truly empty and does not send anything on bang anymore.
Cheers...
...Diemo
How about sending 32 to [itoa]?
maybe not the most efficient solution, but one that works at least: [jstrigger ('')]
As you've noticed, a symbol consisting of an empty string is a strange animal in Max, and it won't get saved in a message box.
You might want to take a lateral approach to the problem. Can you use some other special symbol to get the job done? Rick's solution will give you a symbol consisting of a single blank character (not quite the same as an empty string, and if that works you could also try storing a single blank character (" ") in your message box. Alternately, you could send a zero to [itoa], which should generate the NUL character (which is pretty close to an empty string).
What are you actually trying to accomplish with the empty string?
nope, not a string containing a space character, but a string of length 0, as produced, but not kept, by "".
[Hmmm, did send this by mail, but replies to follow-ups by mail don't get posted?]
Thanks to all for your prompt and, as always in this great community, mostly pertinent replies!
The string containing would do it (it was to be sent to an sprintf %s to make that disappear within a larger string). I had before dabbled with a regex that would finally remove the unwanted character (using %0 for substituting nothing, which could just be the empty string, if there was a way to write it properly in max...).
I wound up rewriting the patch properly to not need the empty string anymore.
Cheers!...
...Diemo
Yup I misread "" as " " and although you've reworked you patch here's a bit of fun.
Wow, that's genius! An empty umenu item to get a truly empty string into a messagebox!
maybe use a placeholder?
if you send the symbol "emtpy" you can later do [route empty], and this way you can be sure things will always work as expected.
-110
I've solved this by writing an external Java code MaxObject, that when it receives a bang it send out and empty string. I use it in the patch using the mxj object.
BUT !!! From my experience, using Java inside Max (using the mxj object) is causing My Max-6 to crash after long time that Max is open. I am not sure of that yet, but that's how it seems now, I am still investigating.
I guess you could do the same with a javascript. I didn't try it.
sending a 0 to [itoa] worked for me... :)