Forums > MaxMSP

Sending forbidden characters to Text object ?

July 23, 2013 | 12:10 am

Hi
My text format is something like this
open "terminal" 127.0.0.1; "OSC" 8997;
But when I send this to Text Object using cr command it filters these characters " ;
open terminal 127.0.0.1 OSC 8997

My question :
is there a way to store these characters " ; within Text object ?

Regards


July 23, 2013 | 1:24 am

if you add a \ before each conflicting character it should do what you want. Plus, you can simply pass your entire string as one symbol thanks to the [tosymbol] object, maybe you should try this too ?


July 23, 2013 | 3:54 am

The characters aren’t "forbidden", they just have special meaning in Max. Quotation marks serve to delimit symbols with embedded spaces. Symbols that don’t have embedded spaces don’t need quotation marks, so the Max parser loses them for you. It may not seem like a feature, but it is (sorta).

There are a lot of other special characters (commas, semicolons, dollars, etc.) It’s important to be aware of these otherwise you’re going to get tripped up by other things.

The backslash has the special meaning of "ignore the special meaning of the next character," which can be useful (and is one of Vichug’s suggestions). However, if your text gets parsed multiple times by the Max engine, each parse operation will strip away a layer of backslashes. The upshot of this is that you may need to add multiple backslashes to get the effect you want in your patch. You may ultimately need to write something like open \\\\"terminal\\\\" 127. You may need to experiment to get this right.


July 23, 2013 | 3:41 pm

This \ really helped
I used sprintf for my data manipulation but it seems it does not like \ specially when it comes with " ,so I return to good old massage box and $ thing .

Thanks to your thoughts VICHUG and PETER its almost done the only thing is left is the annoying white space at the beginning of my two symbols .
any solution to get rid of that ?

Here is the patcher

<code>

– Pasted Max Patch, click to expand. –

</code>


July 23, 2013 | 4:36 pm

The sprintf approach seems to work here and no issues with whitespace.

<code>

– Pasted Max Patch, click to expand. –

</code>


July 23, 2013 | 5:34 pm

Ahh! Many thanks ,I totally forgot the symout


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