monticel@lyman.pppl.gov (Don Monticello) (12/12/90)
I'd like to be able to print the current selection in xterm. Currently I type "lpr<ret>" and paste the selection into standard input. This is a kludge because it sometimes looses text. Is there a better way? Don Monticello monticello@lyman.pppl.gov
rlh2@ukc.ac.uk (R.L.Hesketh) (12/12/90)
In article <696@lyman.pppl.gov> monticel@lyman.pppl.gov (Don Monticello) writes: >I'd like to be able to print the current selection in xterm. >Currently I type "lpr<ret>" and paste the selection into standard >input. This is a kludge because it sometimes looses text. Is there a >better way? There certainly is .. its called "xselection" and can be picked up from expo.lcs.mit.edu under contrib/xselection.tar.Z or from a comp.sources.x archive somewhere. I have a button on my screen that does just this .. I select some text and then press the "lpr selection" button. The button runs a script that finds the nearest printer and then does a .. xselection PRIMARY | lpr -P$printer xselection lets you set and retrieve selection property and now cutbuffer contents. xselection is mainly used in shell scripts to do simple interactions in X. Richard Hesketh Computing Officer, Computing Lab., University of Kent at Canterbury, Canterbury, Kent, CT2 7NF, United Kingdom. Tel: +44 227 764000 ext 7620/7590 Fax: +44 227 762811
mmm@cetia1.cetia.fr (Mark Martin) (12/17/90)
In article <696@lyman.pppl.gov> monticel@lyman.pppl.gov (Don Monticello) writes: >I'd like to be able to print the current selection in xterm. Here's a grotty little shell script I use. Not perfect, but cheap. ---------cut here------------- #!/bin/sh # return selected text. Mark Martin. cetia. france. # xprop returned format is (eg) CUT_BUFFER0 = "echo \"cetia\\\"\n" # get the \" and \\ and \n undone. sadly sed wont take long lines. # sed wont read input not ending in newline, so need to chop off final newline # use bell as newline marker. bell= xprop -root -notype CUT_BUFFER0 | sed '1s/[^=]*= "// s/\\n/'"$bell"'/g s/\\"/"/g s/\\\\/\\/g $s/"$//' | tr -d '\012' | tr $bell '\012' ----------------------------- Mark M Martin mmm@cetia.fr Cetia (BP 244), inria!cetia!mmm 150 rue Marcelin Berthelot, tel +33 94 08 80 00 ZI Toulon Est, fax +33 94 08 80 01 83078 TOULON CEDEX 9, France
simon@gmdtub (Simon Leinen) (12/18/90)
>>>>> On 11 Dec 90 18:53:42 GMT, monticel@lyman.pppl.gov (Don Monticello) said:
Don> I'd like to be able to print the current selection in xterm.
Don> Currently I type "lpr<ret>" and paste the selection into standard
Don> input. This is a kludge because it sometimes looses text. Is
Don> there a better way?
Richard Hesketh's `xselection' program can do this without cutting and
pasting:
xselection PRIMARY | lpr
Xselection is FTPable as expo.lcs.mit.edu:/pub/contrib/xselection.tar.Z
-rw-rw-rw- 1 ftp 9233 Nov 2 03:35 xselection.tar.Z
--
Simon.