Command Line Interface: eccapt


The information provided below applies to the UNIX versions of EasyCopy.

The screen capture functions of EasyCopy can also be activated by the eccapt command line interface described here.
 
$ eccapt [options] [output-file]

 
If the output-file parameter is present, it must appear last. It denotes the filename you want to use for saving the captured screen image. If an existing file is specified it will be overwritten. If no output file is specified, eccapt writes to stdout. This allows you to pipe the output to other programs, for example ecview, ecprint, or ecconv.

The eccapt program uses right-to-left precedence: if an option is duplicated, the value supplied with the one that is last specified (rightmost) is used. Options and parameters (apart from path and display names) can be abbreviated as long as they can be uniquely identified. For example, -help can be abbreviated to -h. Options and parameters (apart from path and host names) may be entered with uppercase or lowercase letters and with optional underscores between "words". Letters are converted to lowercase and underscores are removed during parsing. For example, -Capture_mode and -capturemode are treated the same.

Basic Options

-sys sysdir
Specifies the system directory directory where the password file is stored. If the -sys option is not supplied, the directory pointed to by the SYSDIR variable is used. The program terminates with an error message if the path name is not available. The installation procedure supplies a default value for this option by setting the SYSDIR variable in the invocation script.
 
-tmp tmpdir
Specifies the path name of the directory, where temporary files may be written. If the -tmp option is not supplied, the directory pointed to by the TMPDIR variable is used for temporary files. The installation procedure supplies a default value for this option by setting the TMPDIR variable in the invocation script.
 
-inifile initialization-file
Specifies the path name of the system-wide initialization file, ecrc. If the -inifile option is not supplied, the file pointed to by the INIFILE variable is used. The program terminates with an error message if the path name of the system-wide initialization file is not available. The installation procedure supplies a default value for this option by setting the INIFILE variable in the invocation script.

Informational Options

-help
Displays help and usage information.
 
-version
Displays the version and release date of the eccapt program.

Capture Options

A default interactive mode (
see below) applies if no capture type option is supplied. If the command line supplies more than one capture type option only the last one is used.
-fullscreen
Specifies capture of the full screen.
 
-window window-id
Specifies capture of the window (excluding frame) with the specified id.
 
-region widthxheight+xoffset+yoffset
Specifies a particular region to capture in terms of screen pixel coordinates.
 
-position
Capture the window below the mouse pointer’s current position (that is, you must position the mouse pointer before eccapt is called). The frame of the window is included if the mouse pointer is positioned on the frame. This mode is only available in the command line interface. It is not available from EasyCopy’s graphical user interface.
 
Interactive mode
The default mode, if no capture type option is supplied, is a special interactive mode which is only available in the command line interface. It is not available from EasyCopy’s graphical user interface. The capture selection in interactive mode is done with use of the mouse. The cursor changes to a cross.

You can then define what you want to capture in one of the following four ways:

Full screen
Point at screen canvas and click a button on the mouse.
Window excluding frame
Point inside the window and click a button on the mouse.
Window including frame
Point at the window frame and click a button on the mouse.
Arbitrary rectangular region
  1. Press mouse button to affix the first corner point of the region.
  2. Drag the mouse pointer until the desired region is defined.
  3. Release the mouse button to complete the definition. A rubber band appears while the mouse pointer is dragged.
-beep { true | false }
Issue a beep before and after screen capture. The default value is set in the initialization file.
 
-display hostname:server.screen
Specifies the display on which the screen capture is to be performed. If the display is not specified, the DISPLAY variable is used. If the DISPLAY variable is not set, the local screen (localhost:0.0) is the default display. You need a license for both systems to capture a remote display. You cannot capture a remote display if you have a single node license.
 
-application window-id
Specifies the window id of the main window of the calling application. This is used if the application must be hidden during screen capture. When this option is specified an output file name must also be specified.
 
-delay seconds
This enforces a time delay (in seconds) when capturing. The delay applies if the graphical user interface of the application overlaps the screen area to be captured, and it has been specified that this window is hidden during capture. Occasionally, the system’s event handling may initiate the capture event before the menu has been hidden, or the desired redraw events have completed; this conflict is resolved by inducing a delay. The default is supplied in the initialization file.

Capture Modes

-capturemode { xe | xwd }

On all UNIX platforms choose between the following capture modes:
xe (X Enhanced Mode)
X Enhanced Mode is used for correct capture of all windows controlled by the X Window system. Colors of individual windows are preserved when you capture the full screen or a region with any combination of windows. Even when a window appears in pseudo-color on the screen (due to color map restrictions) it is captured with its original colors. This is the default capture mode (unless you change it in the initialization file).
xwd (XWD Mode)
For more simple requirements you can use XWD Mode as a faster alternative. The capture is performed by a system call to the X Window capture program xwd which must be on the path. Images captured in X Enhanced Mode and XWD Mode are always saved in XWD format. Only if all captured entities are described in the X Window System by one common color map, the XWD file is color mapped; otherwise the XWD file is 24-bit RGB, and color mapped windows or frames are expanded to 24 bits.
Silicon Graphics
-capturemode { xe | xwd | gl }
gl (GL Mode on SGI)
GL capture is available on the local display, and on remote displays, but only from one Silicon Graphics workstation to another. Select GL Mode to capture windows that have been generated by GL-based applications or other non-X applications if they contain elements that cannot be "seen" by the X Window System.

Capture in GL Mode on Silicon Graphics is performed by a system call to the native SGI screen capture program scrsave which must be on the path, and the captured image is saved in SGI raster format (RGB).


 
IBM RS/6000
-capturemode { xe | xwd | gl1 | gl2 | gl3 | gl4 | gl5 }
gl1 ... gl5 (GL Mode on IBM RS/6000)
GL capture is available on IBM RS/6000 workstations, but only if the local display is used. The frame buffer (1 through 5) to be captured must also also specified.
  1. RGB, front buffer
  2. RGB, back buffer
  3. RGB, full buffer
  4. Color map, front buffer
  5. Color map, back buffer
Select GL Mode to capture windows that have been generated by GL-based applications or other non-X applications if they contain elements that cannot be "seen" by the X Window System.

GL Capture on IBM RS/6000

The information provided in this section is intended for the System Administrator
Capture in GL mode on IBM RS/6000 is performed by the program capgl which saves images in XWD format. It is an independent capture program that enables IBM RS/6000 users to capture GL windows.

The information provided here is included for reference and as an aid in troubleshooting situations. The command line interface to capgl is the following:

$ capgl file x0 x1 y0 y1 window buffer
 

file
The name of the XWD file in which the captured screen is saved.
 
x0 x1 y0 y1
The left, right, bottom, and top edge of the area to be captured. The origin of the screen coordinate system is the lower left corner of the display.
 
window
The window id of the window to be captured
 
buffer
The GL buffer mode is specified as a number (1-5). The buffer modes are explained on the previous page.

Configuration of Hot Keys in a Window Manager

The information provided in this section is intended for the System Administrator
It is possible to configure an X Window Manager to execute specific actions when some key combination is pressed. This is known as key binding.

You can, for example, use this to provide hot keys for screen capture independently of EasyCopy’s graphical user interface.
It is recommended, to use the Hot Keys dialog to setup hot keys. The methods described below are provided for the case that you want to use eccapt in a customized solution.
The examples provided show how to bind three key combinations:
Key Shell script (example)
PrintScreen /mnt/hotkeys/PrtScr
Shift F1 /mnt/hotkeys/shiftF1
Ctrl F1 /mnt/hotkeys/ctrlF1
Key binding is implemented by entries in the X Window Manager’s resource file and application defaults file. The details depend on which X Window Manager you use.

Mwm (Motif Window Manager)
The resource file .mwmrc resides in your home directory (if not found a system-wide file /usr/lib/X11/system.mwmrc applies). Locate this sequence:
Keys DefaultKeyBindings
{ ...
}
Insert the following lines inside the {...} block:
<Key>Print root|icon|window f.exec "/mnt/hotkeys/PrtScr &"
Shift<Key>F1 root|icon|window f.exec "/mnt/hotkeys/shiftF1 &"
Ctrl<Key>F1 root|icon|window f.exec "/mnt/hotkeys/ctrlF1 &"
To make sure that the DefaultKeyBindings section is used the Mwm file in your home directory (or system-wide /usr/lib/X11/app-defaults/Mwm) must contain the line:
Mwm*keyBindings: DefaultKeyBindings
To make the key bindings active the Window Manager must be restarted.

Dtwm (CDE Window Manager)
The resource file .dt/dtwmrc resides in your home directory (if not found a system-wide file /usr/dt/config/C/sys.dtwmrc applies). Locate the sequence
Keys DtKeyBindings
{ . . .
}
Insert the following lines inside the {...} block:
<Key>Print root|icon|window f.exec "/mnt/hotkeys/PrtScr &"
Shift<Key>F1 root|icon|window f.exec "/mnt/hotkeys/shiftF1 &"
Ctrl<Key>F1 root|icon|window f.exec "/mnt/hotkeys/ctrlF1 &"
To make sure that the DtKeyBindings section is used the Dtwm file in your home directory (or systemwide /usr/dt/app-defaults/C/Dtwm) must contain the line:
Mwm*keyBindings: DtKeyBindings
To make the key bindings active the Window Manager must be restarted.

4Dwm (Window Manager on SGI workstations)
The resource file .4dwmrc resides in your home directory (if not found a system-wide file /usr/lib/X11/system.4Dwmrc applies). Locate the sequence
Keys 4DwmKeyBindings { . . . }
Insert the following lines inside the {...} block:
<Key>Print root|icon|window f.exec "/mnt/hotkeys/PrtScr &"
Shift<Key>F1 root|icon|window f.exec "/mnt/hotkeys/shiftF1 &"
Ctrl<Key>F1 root|icon|window f.exec "/mnt/hotkeys/ctrlF1 &"
To make sure that the 4DwmKeyBindings section is used the 4DWm file in your home directory (or system-wide /usr/lib/X11/app-defaults/4DWm) must contain the line:
Mwm*keyBindings: 4DwmKeyBindings
To make the key bindings active the Window Manager must be restarted.

Vuewm (Window Manager on HP workstations)
The resource file .vue/vuewmrc resides in your home directory (if not found a system-wide file /usr/vue/config/sys.vuewmrc applies). Locate the sequence
Keys VueKeyBindings { . . . }
Insert the following lines inside the {...} block:
<Key>Print root|icon|window f.exec "/mnt/hotkeys/PrtScr &"
Shift<Key>F1 root|icon|window f.exec "/mnt/hotkeys/shiftF1 &"
Ctrl<Key>F1 root|icon|window f.exec "/mnt/hotkeys/ctrlF1 &"
To make sure that the VueKeyBindings section is used the Vuewm file in your home directory (or system-wide /usr/vue/app-defaults/Vuewm) must contain the line:
Mwm*keyBindings: VueKeyBindings
To make the key bindings active the Window Manager must be restarted.

Twm (Tab Window Manager)
The resource file .twmrc resides in your home directory (if not found a system-wide file /etc/X11/twm/system.twmrc applies). Insert the following lines:
"Print" = all : f.exec "/mnt/hotkeys/PrtScr &"
"F1" = s : all : f.exec "/mnt/hotkeys/shiftF1 &"
"F1" = c : all : f.exec "/mnt/hotkeys/ctrlF1 &"
To make the key bindings active the Window Manager must be restarted.

Fvwm (Feeble Virtual Window Manager)
The resource file .fvwmrc resides in your home directory (if not found a system-wide file /etc/X11/fvwm/system.fvwmrc applies).

Insert the following lines:
Key Print Exec "PrtScr" /mnt/hotkeys/PrtScr &
Key F1 AT S Exec "shiftF1" /mnt/hotkeys/shiftF1 &
Key F1 AT C Exec "ctrlF1" /mnt/hotkeys/ctrlF1 &
To make the key bindings active the Window Manager must be restarted.

Shell Script Examples

The information provided in this section is intended for the System Administrator
These examples can, for instance, apply to
hot key association or system calls from your own application.

Pipe a Captured Image into EasyCopy's Print Dialog
EasyCopy's graphical user interface opens in a special print mode when an input file is supplied on stdin (refer to the description of
ecx). The Main window is not shown; the Print dialog is entered directly:

You can now press Print to print the image supplied on stdin, or you can first modify the printer setup, layout, or other options.

In this mode EasyCopy terminates after you press Print or Cancel.

You can utilize this in a shell script where you pipe the image captured by eccapt into EasyCopy, and associate this script with a hot key, for example the Ctrl+PrintScreen key.

Pressing Ctrl+PrintScreen will then have the effect that you first capture a window or an area, and then get the Print dialog that allows you to print the captured image.

Local Setup
 
#!/bin/sh
eccapt | ecx -

 
This example script calls eccapt with default parameters. This implies that the interactive capture type applies. If you need other options you can specify these in the script, for example to capture the full screen and force a beep before and after screen capture:
 
#!/bin/sh
eccapt -fullscreen -beep true | ecx -

 
If you need a choice between options, you must configure two (or more) hot keys, for example Ctrl+PrintScreen for one set of options (one variant of the script) and Shift+PrintScreen for an alternate set of options (another variant of the script).
 
Remote Setup
For remote use you must change the script to access EasyCopy on the remote server. This example assumes that the name of the remote server is pserver; you must substitute this with the correct server name.
 
#!/bin/sh
xhost pserver
rsh pserver eccapt -display `hostname`:0.0 |
rsh pserver ecx - -display `hostname`:0.0

 
`hostname` is automatically replaced by the name of your local workstation.
 
The described approach requires that you have a home directory on the server. You can avoid that the script prompts you for a password for accessing the server, if your home directory on the server contains an .rhosts file in which you specify, that your workstation node can login without password.

Immediate Print of the Captured Image
You can also pipe the captured image directly into ecprint if you want to print it without opening the graphical user interface.

Local Setup
 
#!/bin/sh
eccapt | ecprint -printer prt1 -size 4 | lpr -Pprt1

 
This example assumes that you want to scale the captured image to a width of 4 inches and want to send the print job to a printer installed under the name prt1 on the print queue prt1.
 
The last pipe ( | lpr -Pprt1) indicates that the printer is connected to the print queue prt1 in a BSD print system.
Network Setup
For remote use you must change the script to access EasyCopy on the remote server.
 
This example assumes that the name of the remote server is pserver; you must substitute this with the correct server name.
 
#!/bin/sh
xhost pserver
rsh pserver eccapt -display `hostname`:0.0 |
rsh pserver ecprint -printer prt1 -size 4 -display `hostname`:0.0 |
rsh pserver lpr -Pprt1

 
`hostname` is automatically replaced by the name of your local workstation. The described approach requires that you have a home directory on the server. You can avoid that the script prompts you for a password for accessing the server, if your home directory on the server contains an .rhosts file in which you specify, that your workstation node can login without password. Save the Captured Image as a TIFF File You can pipe the captured image into ecconv to convert it from XWD format to another format of your choice, for example TIFF. #!/bin/sh eccapt | ecconv -export tif -compression lzw > /usr/tmp/0001.tif The resulting TIFF file is here saved by ecconv as /usr/tmp/0001.tif.

Copyright © 2005, AGI (autoGraph international), www.augrin.com.