Re: [PD] scripting pd printouts
Seems to do what I want now. One argument, the directory of the Pd files. It incorporates awk script inline to correct the font problems and slows it down enough to be okay even for large Pd files, but still fast enough. Thanks all for help with this. On Sun, 29 Apr 2007 23:40:42 +1000 simon wise <[EMAIL PROTECTED]> wrote: > I think I needed dinner - > > wait isn't mean what I thought it was, > don't know why it worked > > but it seems to work ok without it - and I worked out how to close > the patch > > attached are better examples > > simon > > > > > On 29 Apr 2007, at 10:04 PM, simon wise wrote: > > > > > On 29 Apr 2007, at 3:48 AM, Frank Barknecht wrote: > > > >> I tried to make this into a sh-script, but while it prints okay, it > >> only generates an "empty" ps-file: the ps-file isn't empty, but > >> the patch > >> it shows is. > >> > >> Anyway, attached also is the sh-script that doesn't work correctly. > >> Any ideas for a fix? > > > > same here - possibly the patch gets printed before it is drawn?? > > > > with the 'wait' these work for me - with printer.pd already open in > > pd, try: > > > > pdprint2.sh name /path/to/directory > > > > > > > > simon > > > > > > > > > > > > > > -- Use the source printer.pd Description: Binary data #!/bin/sh # print a directory of pd files as postscript # args: 1: directory of pd patches to print # try altering /findfont 9/ to another font size if problems pd -nomidi -noaudio ./printer.pd & sleep 2 for i in $1*.pd do echo printing $i sleep 1 echo "pd open $i ./;" | pdsend 3001 sleep 1 echo "pd-$i print $i.ps, menuclose;" | pdsend 3001 sleep 1 awk 'BEGIN {last = -10} /findfont 9/ { last=NR $3 = 11.3 } { if (NR == last+2) { $1 = $1+1 $2 = $2-2 } print }' $i.ps > $i-cp.ps rm $i.ps mv $i-cp.ps $i.ps done___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
I'm gonna try Franks method too in a moment. What I ran up against last night was this: I have rather a large directory of pd file to print. A method that loads Pd anew for each patch takes a "long" time. And I still had the problem of closing each instance. I was going to fork, get a PID and then kill from bash or perl. But scripting many instances of Pd too fast caused some evil crashes (on my machine at least). Learning a lot about this thanks to all. On Mon, 30 Apr 2007 00:35:34 +1000 simon wise <[EMAIL PROTECTED]> wrote: > yeh - it makes more sense to do it as a patch, I wanted to follow up > Andy's ideas, and wanted to test that message path - perhaps he has a > larger context where a bash script is more appropriate? but you > probably wouldn't want to use the 'old' option in [netreceive] anyway. > > simon > > On 30 Apr 2007, at 12:08 AM, Frank Barknecht wrote: > > > Hallo, > > simon wise hat gesagt: // simon wise wrote: > > > >> same here - possibly the patch gets printed before it is drawn?? > > > > Probably. > > > >> with the 'wait' these work for me - with printer.pd already open in > >> pd, try: > >> > >> pdprint2.sh name /path/to/directory > > > > I now made a little abstraction for printing. It doesn't deal with > > generating the list of files to print, this can come from a > > [textfile], a directory listing external, netreceive or whatever. > > Attached [print-patches] does just that: It prints patches. > > > > Ciao > > -- > > Frank Barknecht _ __footils.org_ __goto10.org__ > > > > > > ___ > > PD-list@iem.at mailing list > > UNSUBSCRIBE and account-management -> http://lists.puredata.info/ > > listinfo/pd-list > > > > > ___ > PD-list@iem.at mailing list > UNSUBSCRIBE and account-management -> > http://lists.puredata.info/listinfo/pd-list -- Use the source ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
Nice. Thanks for playing with this. I dug myself into a terrible pit with this last night. To be honest there are still subtle things I really don't understand. I tried putting sleep commands in a perl script because I guessed it was a print before draw type problem, but I got into a mess with the syntax again. The plan was to fork a load of Pd instances in parallel because it was taking a long time to do each print. Will play around with this some more and see what I get. Cheers, Andy On Sun, 29 Apr 2007 23:40:42 +1000 simon wise <[EMAIL PROTECTED]> wrote: > I think I needed dinner - > > wait isn't mean what I thought it was, > don't know why it worked > > but it seems to work ok without it - and I worked out how to close > the patch > > attached are better examples > > simon > > > > > On 29 Apr 2007, at 10:04 PM, simon wise wrote: > > > > > On 29 Apr 2007, at 3:48 AM, Frank Barknecht wrote: > > > >> I tried to make this into a sh-script, but while it prints okay, it > >> only generates an "empty" ps-file: the ps-file isn't empty, but > >> the patch > >> it shows is. > >> > >> Anyway, attached also is the sh-script that doesn't work correctly. > >> Any ideas for a fix? > > > > same here - possibly the patch gets printed before it is drawn?? > > > > with the 'wait' these work for me - with printer.pd already open in > > pd, try: > > > > pdprint2.sh name /path/to/directory > > > > > > > > simon > > > > > > > > > > > > > > -- Use the source ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
yeh - it makes more sense to do it as a patch, I wanted to follow up Andy's ideas, and wanted to test that message path - perhaps he has a larger context where a bash script is more appropriate? but you probably wouldn't want to use the 'old' option in [netreceive] anyway. simon On 30 Apr 2007, at 12:08 AM, Frank Barknecht wrote: > Hallo, > simon wise hat gesagt: // simon wise wrote: > >> same here - possibly the patch gets printed before it is drawn?? > > Probably. > >> with the 'wait' these work for me - with printer.pd already open in >> pd, try: >> >> pdprint2.sh name /path/to/directory > > I now made a little abstraction for printing. It doesn't deal with > generating the list of files to print, this can come from a > [textfile], a directory listing external, netreceive or whatever. > Attached [print-patches] does just that: It prints patches. > > Ciao > -- > Frank Barknecht _ __footils.org_ __goto10.org__ > > > ___ > PD-list@iem.at mailing list > UNSUBSCRIBE and account-management -> http://lists.puredata.info/ > listinfo/pd-list ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
Hallo, simon wise hat gesagt: // simon wise wrote: > same here - possibly the patch gets printed before it is drawn?? Probably. > with the 'wait' these work for me - with printer.pd already open in > pd, try: > > pdprint2.sh name /path/to/directory I now made a little abstraction for printing. It doesn't deal with generating the list of files to print, this can come from a [textfile], a directory listing external, netreceive or whatever. Attached [print-patches] does just that: It prints patches. Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ print-patches-help.pd Description: application/puredata print-patches.pd Description: application/puredata ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
I think I needed dinner - wait isn't mean what I thought it was, don't know why it worked but it seems to work ok without it - and I worked out how to close the patch attached are better examples simon On 29 Apr 2007, at 10:04 PM, simon wise wrote: On 29 Apr 2007, at 3:48 AM, Frank Barknecht wrote: I tried to make this into a sh-script, but while it prints okay, it only generates an "empty" ps-file: the ps-file isn't empty, but the patch it shows is. Anyway, attached also is the sh-script that doesn't work correctly. Any ideas for a fix? same here - possibly the patch gets printed before it is drawn?? with the 'wait' these work for me - with printer.pd already open in pd, try: pdprint2.sh name /path/to/directory simon printer.pd Description: Binary data pdprint2.sh Description: Binary data ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
On 29 Apr 2007, at 3:48 AM, Frank Barknecht wrote: I tried to make this into a sh-script, but while it prints okay, it only generates an "empty" ps-file: the ps-file isn't empty, but the patch it shows is. Anyway, attached also is the sh-script that doesn't work correctly. Any ideas for a fix? same here - possibly the patch gets printed before it is drawn?? with the 'wait' these work for me - with printer.pd already open in pd, try: pdprint2.sh name /path/to/directory simon printer.pd Description: Binary data pdprint2.sh Description: Binary data ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
Hallo, Andy Farnell hat gesagt: // Andy Farnell wrote: > I'm still banging my head against this and getting nowhere today > though. I'm sure it's not my stupidity, I've reduced this to the most simple > test case of a message to the window and still i get no output. > > Does this patch work for you? Attached is the fixed version of this patch: You need to add a "pd-" to the receiver. I tried to make this into a sh-script, but while it prints okay, it only generates an "empty" ps-file: the ps-file isn't empty, but the patch it shows is. Anyway, attached also is the sh-script that doesn't work correctly. Any ideas for a fix? Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ simpleprint.pd Description: application/puredata pdprint.sh Description: Bourne shell script ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
those are the Mac layout versions - you'll need to move things around a bit for Linux, I've got those layouts as well - all the work on trying to get the same font/layout working across platforms is VERY appreciated - I look forward to the day I don't have to keep 2 versions of everything that needs a nice GUI! simon On 29 Apr 2007, at 12:45 AM, simon wise wrote: > > On 28 Apr 2007, at 1:54 PM, Andy Farnell wrote: > >> Thanks very much. A working example would be most welcome as I >> still can't >> get "print" message to be recognised. > > here are patch(es) - it's got a lot more than you want, since it is > part of my general system for linking patches and machines, but it > illustrates the process and I've put in printing to a file as well > - you'll need to work out the way to sequence it all in the script, > or just build the sequencing part in pd instead. Open tools.pd. > > > simon > > > > ___ > PD-list@iem.at mailing list > UNSUBSCRIBE and account-management -> http://lists.puredata.info/ > listinfo/pd-list ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
On 27/04/2007, at 2.15, Hans-Christoph Steiner wrote: > the complete contents of the Pd window My experience is, that only the visible part of the patch window will be printed (to postscript). That is, not the part, if any, that is not visible in the patch window. ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
Hallo, Andy Farnell hat gesagt: // Andy Farnell wrote: > I'd like to use the print function in Pd, in a batch process > to create postscript files of an entire directory of patches. > > I imagined a FUDI solution from a Bash script something like > > pd -nogui &. start a pd instance Did you try without "-nogui"? > for i in *.pd > pdsend pd open $i > pdsend pd print $i.ps > ...etc Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
Hans-Christoph Steiner wrote: > > I've been thinking that it would be very handy to be able to get the > complete contents of the Pd window in Pd space. Then you could parse > the error messages in Pd space and have your program respond. I > tried for a little bit to code it, but it was not as easily as it > seemed at first glance. > i think i (and others) have posted several solutions to this in the past. however, i think that padawan's question was more into the direction of how to control pd (itself) from outside, which would not involve such feedback-like stuff. so: 1. in order to make printing patches work, the first important thing is, that you must not disable the gui. after all it is tcl/tk that does the patch-to-postscript conversion; when you turn it off, you also turn this feature of pd off. 2. in order to send something to pd via pdsend, you cannot use a syntax like > pdsend pd open $i because this is not how this applications works. "man pdsend" will reveil that you should do something like: > echo "pd open $i;" | pdsend 4321 3. you cannot directly control the pd process via pdsend. pdsend is the command-line version of [netsend], so you can do no more (and no less) with it than with this object: you will need a [netreceive] object in the running instance of pd which will receive the messages sent via pdsend. if you want to control the pd-server, you will have to send the messages received at the [netreceive] via pd's messaging system to the server. (with [send pd]) so basically you will have to start a server pd-patch on your running pd that does the interfacing to the pdsend. the simplest version of this patch would be something like: [netreceive 4321] | [s pd] 4. "pd open $i" is not a valid message to open a file. mfg.asdr IOhannes ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
On 27 Apr 2007, at 8:56 PM, Andy Farnell wrote: > pdsend pd print $i.ps pdsend will need a port number, and you will need a [netreceive] in your pd patches, also note that [netreceive] does not send into the general message space, you will have to parse its output and connect to a [send] object (or set it to work 'old' style, which is quite insecure). See man pdsend and the help for netreceive. Finally you will need to send the appropriate message, ending with a ';' eg: echo "print name.ps;" | pdsend 3000 I could send some examples if you want simon ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Re: [PD] scripting pd printouts
I've been thinking that it would be very handy to be able to get the complete contents of the Pd window in Pd space. Then you could parse the error messages in Pd space and have your program respond. I tried for a little bit to code it, but it was not as easily as it seemed at first glance. That's my two bits. .hc On Apr 27, 2007, at 6:56 AM, Andy Farnell wrote: > > Hi, > > I'd like to use the print function in Pd, in a batch process > to create postscript files of an entire directory of patches. > > I imagined a FUDI solution from a Bash script something like > > pd -nogui &. start a pd instance > for i in *.pd > pdsend pd open $i > pdsend pd print $i.ps > ...etc > > I'm not having much joy. My experience and knowledge of using > FUDI communication is poor and I see a pitfall with passing > an output filename to print. > > Any thoughts most welcome, cheers, > > Andy > > -- > Use the source > > ___ > PD-list@iem.at mailing list > UNSUBSCRIBE and account-management -> http://lists.puredata.info/ > listinfo/pd-list Access to computers should be unlimited and total. - the hacker ethic ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
[PD] scripting pd printouts
Hi, I'd like to use the print function in Pd, in a batch process to create postscript files of an entire directory of patches. I imagined a FUDI solution from a Bash script something like pd -nogui &. start a pd instance for i in *.pd pdsend pd open $i pdsend pd print $i.ps ...etc I'm not having much joy. My experience and knowledge of using FUDI communication is poor and I see a pitfall with passing an output filename to print. Any thoughts most welcome, cheers, Andy -- Use the source ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list