Operating System - HP-UX
1834772 Members
3309 Online
110070 Solutions
New Discussion

how to snapshot a gui window

 
SOLVED
Go to solution
Hanry Zhou
Super Advisor

how to snapshot a gui window

I have a SUN workstation and running CDE environment.

I wanted to snapshot a gui window of a software, and save to a file. how do i do that?

thanks in advance.

Zhou
none
10 REPLIES 10
Sridhar Bhaskarla
Honored Contributor
Solution

Re: how to snapshot a gui window

Hi Zhou,


You can use xwd to capture the x-window and then xpr to print it out. xwd is under /usr/X/bin on SUN I believe.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
S.K. Chan
Honored Contributor

Re: how to snapshot a gui window

Check if you got "xwd" and "xpr".
$ man xpr
$ man xwd
The xwd allow you to dump an x window image to a file and xpr prints it. All I know and used quite a lot is xv. You may want to download it.
http://www.trilon.com/xv/whatisxv.html
Hanry Zhou
Super Advisor

Re: how to snapshot a gui window

Thank you very much for the response.

I do have xwd, But how do I use it? how do I actually dump the window though?

zhou
none
S.K. Chan
Honored Contributor

Re: how to snapshot a gui window

This is what works for me on my HP box ..
$ cd /tmp
$ xwd -out myscreen
==> At this point your cursor will turn to a "plus" sign. Drag your mouse to the frame of the window you want to capture and click it. The file "myscreen" will contain the dump image. You can then view it with ..
$ xwud -in myscreen
Sridhar Bhaskarla
Honored Contributor

Re: how to snapshot a gui window

Hi Zhou,

Run xwd with -out argument.

$xwd -out /tmp/xwd.out

Then click the target window.

You can view the file back using xwud

$xwud -in /tmp/xwd.out

To print the xwd dump file, use "xpr".

$xpr -device ps /tmp/xwd.out |lp -ops -dyour_printername

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
A. Clay Stephenson
Acclaimed Contributor

Re: how to snapshot a gui window

To capture a window:

1) Open a terminal session:

xwd -out /tmp/myimage

xwd will just sit there. Now move the mouse to the desired window and click. You will hear one beep (dump starting) and then two beeps (done).

The data is captured in /tmp/image and xwd terminates.

2) To print: (This example is a LaserJet)

xpr -device ljet /tmp/myimage | lp -dmyprinter

Man xwd, xpr for details.
If it ain't broke, I can fix that.
Hanry Zhou
Super Advisor

Re: how to snapshot a gui window

I am slow man, but when I run
xwd -out myscreen

I got message:
unable to open display ''

Please help!
none
Sridhar Bhaskarla
Honored Contributor

Re: how to snapshot a gui window

Hi,

Your display variable is not set to access the local X server.

DO

$who -m

(note down the IP address|hostname in the last field. If you haven't directly logged onto the box from here, then find out the IP address of the local system).

$DISPLAY=(IP ADDRESSS):0.0
$export DISPLAY
$/usr/X/bin/xwd

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: how to snapshot a gui window

Hmm.. the fundamental question is how did you get your Software GUI started if the display is not set. The DISPLAY would most probably be localhost:0.0. Or take a new window and try.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Suhas_2
Regular Advisor

Re: how to snapshot a gui window

Hi Zhou,
You need to export the DISPLAY variable with the IP address of the workstation.
Secondly on the workstation you must execute the command "xhost +" , then only you can open an X-window session.

Regards'
Suhas
Never say "Die"