SUMMARY: Question: get_selection and solaris2

From: greg harrison (
Date: Tue Oct 01 1996 - 10:38:19 CDT

Thanks to all who responded and gave me the solutions I needed. After
seeing the responses, I really wanted to hit my head against the wall for
being so blind.

I received from the following people: (Mr Rene Occelli)
Torsten Metzner <> (
Terry Gorby <> (Tim Newman) (Dennis Evans) (Ron Loftin)
Michael Wright <
(insert any others I might have missed)

Most were right on the money and reminded me to use /usr/openwin/bin/xv_get_sel
instead of get_selection. A few sent me exactly what they used in their
menus.. You would think I would have realized this since I use it in another
script which I use on both solaris and sunos boxes (*insert sound of dumb
sys-admin slapping his forehead with biggest book he can find*)...

Sample solutions:

"Print Selection" ( xv_get_sel 1 | lpr ;echo '' ) /* print selected text */
"Print Clipboard" ( xv_get_sel 3 | lpr; echo  ) /* print clipboard */
"Print Selected Text" sh -c "xv_get_sel | lp ; echo 'Selection printed'."
"Print window" exec xwd | xpr -device ps -portrait -top 1 | lp
"Print window Rev" exec xwd | xpr -device ps -rv -portrait -top 1 | lp
"Print Selected Text" sh -c "xv_get_sel | fold | lpr ; echo 'Selection Printed..'."

A few people even sent me some scripts that do the above as well.
Thanks a bunch for the responses guys..


************** ORIGINAL MESSAGE ***************************************
Hi oh knowledgable ones...

On our sunos systems, I had a menu selection that allowed a user to
highlight text and dump the highlighted text straight to a printer. The
script I used for this was
                sh -c "get_selection | lpr -h; echo 'Selection printed'."
get_selection was a program located in /usr/bin and was from SunViews
optional software.

Having several of our users now on solaris2, they are screaming for the same
functionalitly, and alas, get_selection doesnt exist nor work in binary compat
mode on the solaris2 boxes. Does anyone know of another method to achieve
dumping highlighted text to a printer that will work on solaris2?

Btw, I did try simply copying get_selection over to the solaris2 boxes, but
it gives an error:

lpr: lw: unknown printer/class
Selection printed. /usr/local/bin/get_selection: fatal: can't open file: errno=2

Any ideas? (Like how to simulate the "copy" key in a script?)
Thanks in advance...

ps. this are ultras running solaris 2.5
* Greg Harrison | "Well, that is one of the most *
* System Administrator | well documented, non-working pieces *
* Analog Devices | of code I have ever written" *
* 7910 Triad Center Drive | -Anonymous *
* Greensboro, NC 27409 | For reply, send a self-abused *
* (910) 605-4359 | stomped antelope to *
* email: | *


This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:11 CDT