txt file to coll

jack@peacockvisualarts.co.uk's icon

Hi there,

I'm trying to load a list from a .txt file into coll through the [text] object, my problem is that the list in the text file is a simple list seperated by new lines,

eg

red
blue
green
purple

I can load this into the [text] object but to get it into coll I need to add the appropriate numbers commas and semi colons

eg

1, red;
2, blue;
3, green;
4, purple;

Is there a simple way to do this, I thought of scrolling through the lines with a counter and using pack to add the numbers but i cant add the comma that way.

Any help would be massively appreciated,

Thanks

Jack

j.y.bernier's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Bang 'query'.

José Manuel Berenguer's icon

you could also try this...

put

red
blue
green
purple

in a file called txt.txt and living in max's searchpath

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

Stefan Tiedje's icon

jack Keenan schrieb:
> Is there a simple way to do this, I thought of scrolling through the
> lines with a counter and using pack to add the numbers but i cant add
> the comma that way.

but coll will do it for you, if you send coll the packed data it will
store it. Then you can write the coll data to disk or open coll and see
the magic happened...

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

jack@peacockvisualarts.co.uk's icon

Thanks so much for all your help, I really appreciate you taking the time to help me on this.

I got it working last night, albeit in a rather hacky version which gradually worked through line by line, your solutions are far more efficient and elegant, and should speed up my patch a great deal.

Now I seem stuck with another problem the text object seems to keep breaking on me, i think i may have a patch named [text] somewhere in max's search patch which keeps loading in instead of the text object, could that be the case? It seems to repair itself if i remove ./patches from the search path and restart.

Thanks again for your advice

Jack

jack@peacockvisualarts.co.uk's icon

Found the offending patch, all text problems solved!!