[comp.sys.sgi] backgrnd proc to dump whole/partial screen to file

pmorris@BBN.COM (phil morris) (07/03/90)

Hi,

I'm wondering if there is a way to write a background process that can
monitor for some key seq (signal?) that would then take over the display
and allow the user to rubberband an area of the screen to dump to a file
as either a bit-map or a postscript file.  Anyone know how to do this
or has already done it?

thanks,

-Phil Morris
 pmorris@bbn.com

" ratcliffe) (07/03/90)

In article <9007021722.aa01256@VGR.BRL.MIL> pmorris@BBN.COM (phil morris) writes:
>Hi,
>
>I'm wondering if there is a way to write a background process that can
>monitor for some key seq (signal?) that would then take over the display
>and allow the user to rubberband an area of the screen to dump to a file
>as either a bit-map or a postscript file.  Anyone know how to do this
>or has already done it?

you'll have to write yer background process from another piece, 
but the part about allowing the user to rubberband an area of the 
screen *is* done in SNAPSHOT(6D).  source for this lives in
/usr/people/4Dgifts/iristools/imgtools/snapshot.c  
refer to the section about 4Dgifts in the "Release and Installation 
Notes" where it lists how to install IF you don't have a 
/usr/people/4Dgifts user account/subtree loaded on yer system.
--
                                             daveus rattus   

                                   yer friendly neighborhood ratman

                              KOYAANISQATSI

   ko.yan.nis.qatsi (from the Hopi Language)  n.  1. crazy life.  2. life
     in turmoil.  3. life out of balance.  4. life disintegrating.  
     5. a state of life that calls for another way of living.

msc@ramoth.esd.sgi.com (Mark Callow) (07/04/90)

In article <9007021722.aa01256@VGR.BRL.MIL>, pmorris@BBN.COM (phil
morris) writes:
|> Hi,
|> 
|> I'm wondering if there is a way to write a background process that can
|> monitor for some key seq (signal?) that would then take over the display
|> and allow the user to rubberband an area of the screen to dump to a file
|> as either a bit-map or a postscript file.  Anyone know how to do this
|> or has already done it?

Here is a shell archive containing 2 files sp and sp.kill.  sp installs a
lightweight PostScript process that watches the print screen key.  When the
print screen key is pressed, sp invokes the scrsave program.  You can change
"scrsave /usr/tmp/scrsave" to "snapshot" if you want to rubberband out the
area to be saved.  sp.kill removes the lightweight process.

Both files should be made executable.

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by  on Tue Jul  3 14:41:40 PDT 1990
# Contents:  sp sp.kill
 
echo x - sp
sed 's/^@//' > "sp" <<'@//E*O*F sp//'
#!/usr/NeWS/bin/psh

systemdict begin

/ScreenPrinter {
    newprocessgroup
    createevent begin
	/Name 16#6F9E def	% PrintScreen key scan code
	/Action [/UpTransition /DownTransition] def
	/Exclusivity true def
	currentdict
    end expressinterest
    {
	awaitevent begin
	    Action /UpTransition eq {
		console rand (Saving screen %\n) fprintf
	        (scrsave /usr/tmp/scrsave) forkunix
	    } if
	end
    } loop
} fork def

end
@//E*O*F sp//
chmod u=rwx,g=rx,o=rx sp
 
echo x - sp.kill
sed 's/^@//' > "sp.kill" <<'@//E*O*F sp.kill//'
#!/usr/NeWS/bin/psh

systemdict /ScreenPrinter known {
    ScreenPrinter killprocess
    systemdict /ScreenPrinter undef
} if

@//E*O*F sp.kill//
chmod u=rwx,g=rx,o=rx sp.kill
 
exit 0
--
From the TARDIS of Mark Callow
msc@ramoth.sgi.com, ...{ames,decwrl}!sgi!msc
"There is much virtue in a window.  It is to a human being as a frame is to
a painting, as a proscenium to a play.  It strongly defines its content."

msc@ramoth.esd.sgi.com (Mark Callow) (07/07/90)

In article <9938@odin.corp.sgi.com>, msc@ramoth.esd.sgi.com (Mark
Callow) writes:
|> 	    Action /UpTransition eq {
|> 		console rand (Saving screen %\n) fprintf

The preceding line prints a message to SYSLOG and was for debugging.  I should
have removed it before posting the program.  Apologies to those who've been
confused.

|> 	        (scrsave /usr/tmp/scrsave) forkunix
|> 	    } if

--
From the TARDIS of Mark Callow
msc@ramoth.sgi.com, ...{ames,decwrl}!sgi!msc
"There is much virtue in a window.  It is to a human being as a frame is to
a painting, as a proscenium to a play.  It strongly defines its content."