Forums > MaxMSP

coll error reading $ symbol

July 18, 2006 | 10:06 am

Hi,
I am trying to save some scripting in a coll object, so the contents/objects of the patch can be saved and recalled by the user. The script contains the symbol # (eg. #0abstraction). When coll writes the script, all the # symbols are converted to $ symbols in the text file (??!). When coll reads the txt file, the following message appears: "error:coll: :errors in text file in line 23."
Line 23 in this case is the line where the first $ symbol appears. Coll wont read beyond this line.

If I edit the txt file with the text edit program and change the $ symbols to the original # symbols, then coll reads the file correctly, though coll will change again those # to $. Why such a fixation? Why the errors?
Thank you
dan


July 18, 2006 | 11:45 am

prueba con esto

[sprintf "%s"]

best
huts

( )
~ O ~ http://www.kineticsoundsystem.com
( )


July 18, 2006 | 1:55 pm

gracias huts.
However, not sure this works. If I understand you correctly, I should end up with something like: "#0abstraction". The problem is that this script refers to and generates new instances of an existing abstraction, called #0abstraction. Windows doesnt allow the use of "" in the naming of files, so I cannot name my abstraction "#0abstraction".
This is how I generate the script:

max v2;
#N vpatcher 0 0 1024 702;
#P origin 49 67;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 796 358 100 9109513 objects name/argument;
#P window linecount 1;
#P comment 567 358 100 9109513 $3: object’s name;
#P window setfont "Fixedwidth Serif" 10.;
#N vpatcher 115 205 715 605;
#P inlet 522 98 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 58 642 106 9109513 autopattr @autoname 1;
#X prestore number[5] 1 0 2;
#P objectname u898000651;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 288 259 27 9240586 + 1;
#P objectname +[1];
#P newex 280 237 27 9240586 i;
#P newex 514 161 26 9240586 t b;
#P objectname receive[4];
#P window setfont "Sans Serif" 9.;
#P number 316 235 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname number[5];
#P outlet 261 482 15 0;
#P inlet 304 102 15 0;
#P connect 5 0 1 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 2 0 4 1;
#P connect 0 0 2 0;
#P connect 7 0 3 0;
#P pop;
#P newobj 755 211 62 9240586 p keepcue;
#P objectname receive[3];
#P window setfont "Sans Serif" 9.;
#P newex 81 642 106 9109513 autopattr @autoname 1;
#X prestore number 1 0 211;
#P objectname u105000653;
#P button 583 189 15 0;
#P outlet 510 428 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 421 341 73 9240586 s packbang3;
#P newex 718 125 79 9240586 r cuereset;
#P objectname receive[2];
#N counter 0 0 1000;
#X flags 0 0;
#P newobj 641 211 103 9240586 counter 0 0 1000;
#P newex 518 82 53 9240586 r cueexp;
#P objectname receive[1];
#P newex 614 161 79 9240586 r cuecounter;
#P objectname receive;
#P inlet 488 130 15 0;
#P outlet 628 426 15 0;
#P inlet 624 212 15 0;
#P inlet 534 129 15 0;
#P window setfont "Sans Serif" 9.;
#P number 412 180 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname number;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 492 193 31 9240586 + 26;
#P objectname +;
#P window setfont "Sans Serif" 9.;
#P comment 667 269 100 9109513 number box names;
#P window setfont "Fixedwidth Serif" 10.;
#P newex 654 247 133 9240586 sprintf %imysoundbank;
#P newex 498 273 104 9240586 pack 0 0 objname;
#P message 512 336 356 9240586 script new $3 hidden newex 640 $2 64 9109513 $0abstraction;
#P window setfont "Sans Serif" 9.;
#P comment 661 182 100 9109513 x and y coordinates;
#P comment 682 359 100 9109513 $2: position;
#P connect 6 0 7 0;
#P connect 3 0 16 0;
#P connect 13 0 6 0;
#P connect 11 0 6 0;
#P connect 6 0 3 0;
#P connect 4 0 17 0;
#P connect 3 0 2 0;
#P connect 13 0 3 1;
#P connect 8 0 3 1;
#P connect 12 0 18 0;
#P fasten 4 0 3 2 659 269 595 269;
#P connect 2 0 10 0;
#P connect 18 0 14 0;
#P connect 14 0 4 0;
#P connect 9 0 4 0;
#P connect 20 0 14 2;
#P connect 15 0 14 3;
#P connect 14 0 20 0;
#P connect 12 0 20 1;
#P pop;


July 18, 2006 | 3:13 pm

max v2;
#N vpatcher 71 51 531 307;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 48 130 305 196617 script new 1 hidden newex 640 2 64 9109513
$0what;
#P newex 48 102 62 196617 prepend set;
#B color 5;
#P message 48 52 50 196617 1 2 what;
#P newex 48 78 306 196617 sprintf script new %ld hidden newex 640 %ld
64 9109513 $0%s;
#B color 5;
#P connect 1 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 3 0;
#P pop;


July 18, 2006 | 3:47 pm

but it works

max v2;
#N vpatcher 358 94 680 399;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 56 53 48 196617 loadbang;
#P newex 56 79 31 196617 t 1 b;
#P message 68 225 80 196617 2 $0what;
#P newex 68 197 62 196617 prepend set;
#B color 5;
#N coll ;
#P newobj 68 172 53 196617 coll;
#B color 5;
#P newex 68 142 52 196617 pak 1 2 x;
#B color 5;
#P message 110 97 45 196617 $0what;
#P newex 110 118 51 196617 tosymbol;
#B color 5;
#P comment 125 174 89 196617 < -- see inside;
#P connect 8 0 7 0;
#P fasten 7 0 4 0 61 165 73 165;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 7 1 2 0;
#P connect 2 0 1 0;
#P connect 1 0 3 2;
#P pop;

best
huts

( )
~ O ~ http://www.kineticsoundsystem.com
( )


July 18, 2006 | 8:46 pm

The # symbol is special, open any max patch as text, and you’ll see that
each line starts with a "#". If a # is within a line, it will be
converted to a $, and the $ will be converted back…

Though it might be a bug of coll, as it happens even when you just edit
the existing coll and resave it (without writing it to disk).

This probably never came up as I can’t imagine that this would ever be
usefull. What do you want to achieve with a scripted #0abstraction? If
that symbol is within a subpatcher it will be replaced with a unique
number on loading, if you create it with scripting, it won’t be replaced…

There is probably a better way to do what you want without touching that
"bug"

Stefan


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


July 18, 2006 | 10:38 pm

Why not regexp the messages going in and out of your coll, replacing
hash marks with something unique but harmless like ampersand or @ or
the string ‘hashmark’?

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de


July 19, 2006 | 9:14 am

yep, no need to go into the bug after all… sorry guys! The solution was, as huts suggested, in saving every script line (and not just the word ‘#0abstraction’ as I thought he meant) as a symbol (1,"script new…0#abstraction"; 2, "script new …" etc). This way coll doesnt change the # into $. Then I can recall the script from coll into thispatcher via fromsymbol.


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