Running external commands after host print jobs
You can run external commands after each of your host print jobs have completed. On the Printer tab on the host printer session:
- Set the Print Destination to File.
- Set Separate Files to Yes. This is necessary because an external command runs in a separate process. It is possible that a second print job could arrive before the external command completes execution, and if the print jobs are not saved as separate files, the arrival of the second print job may cause problems.
- Specify a File Path and Name, and any external commands.
File Path and Name must be valid for the operating system and the external commands must be valid commands for the
operating system.
Windows example
On Windows platforms, you could specify the following: "
c:\tmp\file.* | lpr -o 1 -S server -P printer $<
" where the following are used:- "
c:\tmp\file.*
" is the file that the print data is stored in. Z and I Emulator for Web numerically increments the file name for each print job. In this example, the first file will be named "file.000
", the next will be named "file.001
", and so on. - the "or" sign ("|") separates the file name from external commands and their parameters;
- "
lpr
" is an external command; - "
-o l -S server -P printer
" are parameters for the "lpr
" command; - and "$<" is converted to the file and path name by Z and I Emulator for Web. The command line that would be
executed in this example looks like: "
lpr -o l -S server -P printer c:\tmp\file.000
".
Linux example
On Linux, you could specify the following: "
/home/user/file.* | lpr -b -Pprinter $<
" where the following are used:- "
/home/user/file.*
" is the file that the print data is stored in. Z and I Emulator for Web numerically increments the file name for each print job. In this example, the first file will be named "file.000
", the next will be named "file.001
", and so on. - the "or" sign ("|") separates the file name from external commands and their parameters;
- "
lpr
" is an external command; - "
-Pprinter
" are parameters for the "lpr
" command; - and "$<" is converted to the file and path name by Z and I Emulator for Web.
- "
If the created file contains binary formatting instructions such as escape sequences, it is important to send the file to the printer in binary mode. Make sure to check the correct command syntax prior to usage. |
- On Windows, this option is "
-o l
" as in "lpr -o l
". - On Linux, this option is "
-b
" as in "lpr -b
".
Files are not erased even after the command execution has completed. You must either: |
- Manually delete the files;
- Set the command to erase them. On Windows, the command line would look like this:
"
c:\tmp\file.* | lpr -o l -S server -P printer $< && erase $<
"); - Or create a batch file or shell script to print and delete the files, and specify the batch file or shell script as the external command in the File Path and Name field.
Availability of the lpr client software
The previous examples included the use of the lpr command. The lpr command allows you to send print jobs to printers shared by lpd if the lpr client software is installed.
The lpr client software is available on:
- Unix (AIX, Linux, etc.), OS/2, and Windows 2000
- The lpr client is usually installed by default.
- Windows 98 and Windows Me
- Microsoft does not provide the lpr client for Windows 98 and Windows Me. In order to use lpr, you must install third party lpr client software.
- Windows NT 4.0
- The lpr client software can be installed by installing the TCP/IP Printing services:
- Select Start > Settings > Control Panel and then double-click the Network icon
- Select the Services tab, and then click Add
- Select Microsoft TCP/IP Printing from the list of services, click OK, and click Close
- Shut down and restart your computer when prompted
- Reapply the latest Service Pack
The lpr command accepts different parameters on the various operating systems. Check the lpr documenation of your operating system for the appropriate parameters.
Printing from DOS to a PPA printer (HP Desk Jet 700 series)
By configuring an external command to run after print jobs, you can also print to a PPA printer (for example, the HP Desk Jet 700 series) from DOS. This procedure works for Windows NT 4.0 and Windows 98, whether you are directly connected to the printer or printing to a shared PPA printer with net use. You need to disable bidirectional communication and the launch Toolbox when printing features from the printer's configuration menu by following these steps:
- Click Start > Run.
- Type
HPFCFG14
and click OK. IfHPFCFG14
does not work, try eitherHPFCFG06
orHPFCFG13
. - In the HP DeskJet Configuration dialog box, click Continue.
- Click on Bidirectional Communication and Launch Toolbox When Printing to clear these options, then click OK.
- Click Return to Windows.
- Click Start > Run.
- Type HPFDJC14.INI and click OK. If your system cannot find HPFDJC14.INI, try either HPFDJC06.INI or HPFDJC13.INI.
- If you have the version 10.3 driver in the HP DeskJet 700 series, change the
DSMEnable
parameter from eitherDSMEnable=0100
orDSMEnable=0200
toDSMEnable=0000
. - Click File and Save
- Exit and restart Windows.
Now print the files using the Copy command to lpt1. For example,
copy file.prt lpt1