[PD] Edit Pd file to change coordinates. pdlua or other language?
Fred Jan Kraan
fjkraan at xs4all.nl
Fri Mar 25 17:30:23 CET 2016
> that sounds good. But I think you sent me the same file as before?
> They are exactly alike.
Just checked, and I did send a newer version, I even added a 0.2 version
number in the header. Here it is version 0.3.
On 2016-03-25 01:53 AM, João Pais wrote:
> 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.
Sorry, the script was counting Pd-lines, not lines in the patch. Not
much use if you look at the lines in a code-editor. If a line increment
is done always, you could move it outside the if ...
Counting Pd-lines is useful if you want to correlate objects to the '#X
connect' lines. But this would break down in case of sub-patches. I made
another script for this...
>
> 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.
The newer versions should be better as they prevent #A and #N from being
corrupted.
>
> Best,
>
> Joao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: changeCoords.tcl
Type: text/x-tcl
Size: 2015 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20160325/b1d73279/attachment.tcl>
More information about the Pd-list
mailing list