Hi,

I tinkered around with tcl, until I think I found a version that suits my needs exactly:

- I reversed the selection - if {[lsearch $lineList $lineCount] < 0} {
- I commented out line puts "lines to patch: $lineList", so that the list of patched lines doesn't get saved with the patch output.


It seems that the patch counts each line that begins with # as a real line. But since the pd txt format splits lines, it turns out that there are many lines that don't begin with #N. For example with the 2 objects

#N canvas 1066 230 670 662 gui 0;
#X obj 0 0 cnv 12 400 260 empty \$0-colorh-i empty 20 12 0 14 -220796
-1 0;

there are 3 lines in the text file, but the patch will only count 2. Adding an incr lineCount after the last "puts $patchLine" does the job of matching the number of lines in the text file with the line count.

Thanks very much, I think this is quite good already. I'll tinker a bit more to see if I find out how to also process subpatches and messages. I imagine that adding other if lines it could work.

Best,

Joao

Attachment: changeCoords.tcl
Description: Tcl script

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to