Forums > MaxMSP

new line in Textedit?

December 18, 2006 | 1:57 am

Hello!

i’ve a litle problem!

i need to send a list to the textedit object but all the elements of the list go to the first line

I need them in separated lines! as a "text" :)

ex:

[name date size velocity "p1 c play go 241" etc...]

TO

name
date
size
velocity
p1 c play go 241 — with no " "
etc…

So! there are some way to do that?

Thanks for the help!


December 18, 2006 | 4:03 am

ola Rui, [iter] is your friend to get elements of a list output sequentially.
i am not sure you can have several "lines" in [textedit] , but you could do it in [lcd]…
check these mini examples out :

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 847 319 33 196617 clear;
#P newex 759 291 32 196617 * 15;
#N counter 4;
#X flags 0 0;
#P newobj 759 270 66 196617 counter 4;
#P user lcd 729 349 128 128 1 1 0 0 0;
#P message 744 318 73 196617 moveto 10 $1;
#P newex 729 245 40 196617 t l b b;
#P window linecount 2;
#P comment 734 118 113 196617 display items seperatly in lcd;
#P window linecount 1;
#P newex 729 211 73 196617 prepend write;
#P newex 729 179 25 196617 iter;
#P message 729 152 204 196617 name date size velocity "p1 c play go 241";
#P window linecount 2;
#P comment 206 85 113 196617 send ellements to [textedit] sequentially;
#P window linecount 1;
#P message 475 266 97 196617 p1 c play go 241;
#P newex 475 237 62 196617 prepend set;
#P newex 475 212 64 196617 fromsymbol;
#P message 475 189 95 196617 "p1 c play go 241";
#P newex 201 199 30 196617 t b s;
#P newex 201 271 56 196617 route text;
#P newex 201 298 41 196617 print B;
#P newex 201 173 62 196617 prepend set;
#P newex 201 146 25 196617 iter;
#P message 201 119 204 196617 name date size velocity "p1 c play go 241";
#P user textedit 201 227 374 261 0 3 9;
#P newex 50 171 42 196617 print A;
#P newex 50 141 25 196617 iter;
#P window linecount 5;
#P message 50 71 95 196617 name date size velocity "p1 c play go 241";
#P window linecount 2;
#P comment 43 37 113 196617 output items of a list sequentially;
#P window linecount 1;
#P comment 483 171 100 196617 take the "" off;
#P connect 24 0 25 0;
#P connect 25 0 22 0;
#P connect 26 0 23 0;
#P connect 21 1 22 0;
#P connect 22 0 23 0;
#P connect 21 2 24 0;
#P connect 21 0 23 0;
#P fasten 19 0 21 0 734 243;
#P connect 18 0 19 0;
#P connect 17 0 18 0;
#P connect 14 0 15 0;
#P connect 13 0 14 0;
#P connect 12 0 13 0;
#P connect 10 0 9 0;
#P connect 3 0 4 0;
#P connect 11 1 5 0;
#P connect 11 0 5 0;
#P connect 8 0 11 0;
#P connect 5 0 10 0;
#P connect 7 0 8 0;
#P connect 6 0 7 0;
#P connect 2 0 3 0;
#P window clipboard copycount 27;

Quote: Rui Caldas wrote on Sun, 17 December 2006 17:57
—————————————————-
> Hello!
>
> i’ve a litle problem!
>
> i need to send a list to the textedit object but all the elements of the list go to the first line
>
> I need them in separated lines! as a "text" :)
>
> ex:
>
> [name date size velocity "p1 c play go 241" etc...]
>
> TO
>
> name
> date
> size
> velocity
> p1 c play go 241 — with no " "
> etc…
>
>
> So! there are some way to do that?
>
> Thanks for the help!
—————————————————-


December 18, 2006 | 4:24 am

Quote: Rui Caldas wrote on Sun, 17 December 2006 17:57

> I need them in separated lines! as a "text" :)

if you need them as a textfile you can also write one through [text]. but i am not sure that’s what you are looking for…

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 195 141 20 196617 t b;
#P newex 195 162 50 196617 deferlow;
#P number 195 122 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 195 101 34 196617 zl len;
#P newex 195 207 130 196617 sprintf write myText_%ld;
#N counter;
#X flags 0 0;
#P newobj 195 183 66 196617 counter;
#P newex 78 121 35 196617 t s cr;
#P message 151 128 33 196617 clear;
#P message 119 128 30 196617 open;
#P newex 78 87 25 196617 iter;
#P message 32 47 204 196617 name date size velocity "p1 c play go 241";
#P newex 78 163 40 196617 text;
#P fasten 1 0 2 0 37 83 83 83;
#P fasten 1 0 8 0 37 77 200 77;
#P fasten 3 0 0 0 124 148 83 148;
#P fasten 4 0 0 0 156 151 83 151;
#P connect 5 1 0 0;
#P connect 5 0 0 0;
#P connect 8 0 9 0;
#P connect 2 0 5 0;
#P fasten 7 0 0 0 200 232 64 232 64 153 83 153;
#P connect 9 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 0;
#P connect 6 0 7 0;
#P window clipboard copycount 12;


December 18, 2006 | 11:20 am


December 18, 2006 | 6:48 pm

ola Rui,
i understand your problem now.
did you try the "separator" message for [textedit] ?
in the Reference manual it says :

"The word separator, followed by any symbol, sets that symbol as a line
separator. and treats it as a carriage return when the contents of the buffer
are output. If the buffer contains the text ?red green blue? and the object
receives the message separator green, the next bang received by textedit will
output red (carriage return) blue."

which means you have to include "ghost" words as separators in your scripts at the end of each line.
does not seem to b a good solution but it could work…

Quote: Rui Caldas wrote on Mon, 18 December 2006 03:20
—————————————————-
> Hello!
> Thanks for your help, and sory for my question…
>
> I need to send the list to the textedit object to edit it!
>
> in your example, only the last line is showed… at the first line.
>
> i’ve alredy tried with the text object, but you need to "close" the window of text and press another button to aply the text to the coll object.
>
> If there are some way to detect the "window close" this is no problem, but if i forget to press the button after closing the text window i’m not able to use the new changes!
>
> i’m using coll to store some or lot of small scripts to control the patch. the structure is:
>
> "Name of the script" line 1 line 2 line 3 etc…
>
> so i need to have all lines in the textedit object.
>
> I’m not good in english, and i’m very dificult to explain the patch.
>
> The next patch is what i’m doing….
> ignore the bug in the "add script" button. it only add one script at the first line!
>
> note: when you close the text window you have to press the "save" button to aply to coll!
>
>


December 19, 2006 | 11:36 pm

Hello,

Is this what you’re looking for?

max v2;
#N vpatcher 597 44 1197 444;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 197 113 261 196617 download Jasch externals (see
http://www.maxobjects.com);
#P message 57 187 33 196617 clear;
#P newex 241 189 78 196617 prepend append;
#P newex 137 160 78 196617 prepend append;
#P user textedit 241 219 467 269 32896 3 9 name date size velocity
"p1 c play go 241";
#P message 137 39 220 196617 name , date , size , velocity , "p1
c play go 241";
#P newex 137 130 53 196617 fromascii;
#P newex 137 107 55 196617 append 13;
#P newex 137 68 40 196617 toascii;
#P user textedit 137 277 377 346 32896 3 9 name
date
size
velocity
p1 c play go 241
;
#P comment 179 69 261 196617 download Jasch externals (see
http://www.maxobjects.com);
#P connect 5 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 7 0;
#P connect 9 0 1 0;
#P connect 7 0 1 0;
#P connect 5 0 8 0;
#P connect 9 0 6 0;
#P connect 8 0 6 0;
#P pop;

Georg
On Dec 18, 2006, at 1:57 AM, Rui Fernando Caldas wrote:

>
> Hello!
>
> i’ve a litle problem!
>
> i need to send a list to the textedit object but all the elements
> of the list go to the first line:
>
> ex:
>
> message box
> |—————————————————|
> | name date size velocity "p1 c play go 241" etc… |
> |—————————————————|
>
> to
>
> textedit
> |———————————————|
> | |
> | name |
> | date |
> | size |
> | velocity |
> | p1 c play go 241 — with no " " |
> | etc… |
> | |
> |———————————————|
>
> So! there are some way to do that?
>
> Thanks for the help!
> –
> Rui Fernando Caldas


December 20, 2006 | 1:11 am

YES!!!!!

Hello again!

You example is what i’m looking for!

i will try to implement the objects in the patch and i soon tell you some thing!

Thanks!


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