Printing from Anita

Anita is a very powerfull terminal emulator from April Systems (www.april.se).

By using escape sequences you can redirect output to up to three local printers. The script presented here send the appropriate sequence, then cat's the file.

#! /bin/sh

# Script to print to any of the three printers hanging off a Windows
# PC running Anita. Set the printers up in Windows and tell Anita
# about them (Config -> Printers)

# Run it as script printer-number file-to-print

[ $# -ne 2 ] && exit    # Needs to be two arguments

Off="\033[4i\c"    # Switch OFF the printer
File=""            # Just in case they do something 'silly'

# Associate the correct ESC sequence with arg 1
case $1 in
1) On="\033[5i\c" ;;
2) On="\033[6i\c" ;;
3) On="\033[7i\c" ;;
*) File=/tmp/anita.$$ ; On="" ; Off="" ;;

echo $On
cat $2 >> $File
echo $Off

Comments and suggestions always welcome - tom@tkrh.demon.co.uk