sowa@amdew.llnl.gov (Erik C. Sowa) (01/30/91)
I would like to be able to pipe the contents of the highlighted selection in a terminal window (xterm or dxterm) into various commands, principally lpr. This would give me a "print selection" capability. Any solutions out there? BTW, I am running ultrix 4.0 / DECwindows, but I have the R4 clients. Forgive me if this is a simple question - I have checked the FAQ without success. -- erik sowa (sowa@amdew.llnl.gov,sowa@cms1.llnl.gov)
gjw@spurr.wr.usgs.GOV (Gregory J. Woodhouse) (01/31/91)
>I would like to be able to pipe the contents of the highlighted >selection in a terminal window (xterm or dxterm) into various commands, >principally lpr. This would give me a "print selection" capability. Any >solutions out there? BTW, I am running ultrix 4.0 / DECwindows, but I >have the R4 clients. > >Forgive me if this is a simple question - I have checked the FAQ without >success. > >-- >erik sowa (sowa@amdew.llnl.gov,sowa@cms1.llnl.gov) > Well...Once the text is selected, you can copy it into a string using XGetWindowProperty(), then your application should set up a pipe, and fork of a copy of lpr. (You need to arange that the display connection close across execs.) Then, you just write the string onto the pipe. Gregory Woodhouse gjw@ags.wr.usgs.gov P.S. If you send me mail, I can explain the details of how to do all of this.
peter@ria.ccs.uwo.ca (Peter Marshall) (02/01/91)
In article <1991Jan29.162418@amdew.llnl.gov>, sowa@amdew.llnl.gov (Erik C. Sowa) writes: |> I would like to be able to pipe the contents of the highlighted |> selection in a terminal window (xterm or dxterm) into various commands, |> principally lpr. This would give me a "print selection" capability. Any |> solutions out there? BTW, I am running ultrix 4.0 / DECwindows, but I |> have the R4 clients. I wrote a little routine named xget_selection which I think does this. It is available via anonymous ftp to ria.ccs.uwo.ca as pub/xget_selection.tar.Z. -- Peter Marshall, Manager (Academic Networking) CCS, NSC, U. of Western Ontario, London, Canada N6A 5B7 (519)661-2111x6032 peter.marshall@uwo.ca pm@uwovax (BITNET); peter@ria.uucp
thoth@reef.cis.ufl.edu (Gilligan) (02/01/91)
I once wrote a program that would retrieve the cut-buffer, only to find that there was a better one already out there. It's called xselection. See if you can find xselection on uunet. Otherwise I could mail copies. usage: xselection [ -display display_name ] [ -append | -prepend | -replace ] [ PROPERTY_NAME | -cutbuffer [0-7] ] [ - | [--] new_value ] -- "Until it's on my desk, it's vaporware" (`it' is the NeXT) "Those who would trade freedom for security soon will have neither" B. Franklin I deal with Reality as you _don't_ understand it.
evans@decvax.DEC.COM (Marc Evans) (02/04/91)
In article <1991Jan29.162418@amdew.llnl.gov>, sowa@amdew.llnl.gov (Erik C. Sowa) writes: |> I would like to be able to pipe the contents of the highlighted |> selection in a terminal window (xterm or dxterm) into various commands, |> principally lpr. This would give me a "print selection" capability. Any |> solutions out there? BTW, I am running ultrix 4.0 / DECwindows, but I |> have the R4 clients. How about running another xterm/dxterm in which you execute something like $ cat - | {desired_command} And then just paste the region into this window, followed by a ^D (Control-D or EOF)? In the case of the lpr command you should be able to just say $ lpr and then paste the information and send an EOF. - Marc -- =========================================================================== Marc Evans - WB1GRH - evans@decvax.DEC.COM | Synergytics (603)635-8876 Unix and X Software Contractor | 21 Hinds Ln, Pelham, NH 03076 ===========================================================================
sowa@amdew.llnl.gov (Erik C. Sowa) (02/05/91)
I have received lots of responses about this subject. Thank you, netters. My favorite solution is the program xselection by Richard Hesketh. I put "print selection" f.exec "xselection PRIMARY | lpr" in one of my twm menus, which makes it very painless to invoke. Judging from the volume of replies, both by email and in the news, this question should go into the FAQ. -- erik sowa (sowa@amdew.llnl.gov,sowa@cms1.llnl.gov)