[PD] Edit Pd file to change coordinates. pdlua or other language?
João Pais
jmmmpais at gmail.com
Fri Mar 25 01:53:04 CET 2016
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: changeCoords.tcl
Type: application/x-tcl
Size: 1507 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20160325/cd3d0b75/attachment.tcl>
More information about the Pd-list
mailing list