English Translation of 'faxfilter' and Winword macro
Stephen Davies (scldad@sdc.com.au)
Mon, 10 May 1999 17:37:10 +0930
Teresa Ray <tcray@speedchoice.com> wrote:
> Are there English translations for the 'faxfilter' and the Winword macro for sending faxes from a
> windows machine to a Samba Fax server? If so, where can I obtain a copy?
>
G'day Teri.
The following is my version of faxfilter. It works with MS Word and Word
Perfect as well as plain text.
Cheers,
Stephen
#!/bin/sh
#
# Function :
#
# The destination fax number must appear in the document in
# exactly the following format:
#
# Fax-No: 089-1234-233
#
# The text "Fax-No:" is the critical bit.
#
###########################################################################
MAILER="/bin/mail"
FAXFILE=/tmp/tmp_faxlp.$$
Username=""
Hostname=""
umask 027
#
# lpr params
#
while :
do
case "$1" in
# Username
-n) Username="$2"
shift ; shift
;;
# Hostname
-h) Hostname="$2"
shift ; shift
;;
# ignore other params
-*) shift
;;
# the end
*) break
esac
done
#
# Mail address for result messages
#
if [ "$Username" = "nobody" ];
then
Mailname="postmaster"
else
Mailname=$Username
fi
#
# save the data to a file
#
cat > $FAXFILE
#
# try to extract the fax number
#
TELEFON=`awk '/Fax-No ?: ?[0-9-]*/ \
{ gsub(/-/,""); \
start=match($0,/ ?: ?/); \
start=start+match(substr($0,start),/[0-9]/)-1; \
end=match(substr($0,start),/[^0-9]/)-1; \
printf ("%s",substr($0,start,end)); \
exit
}' $FAXFILE`
if [ "$TELEFON" = "" ]; then
TELEFON=`awk '/Fax\204No:\200[0-9-]*/ \
{ gsub(/-/,""); \
start=match($0,/o:\200/); \
start=start+match(substr($0,start),/[0-9]/)-1; \
end=match(substr($0,start),/[^0-9]/)-1; \
printf ("%s",substr($0,start,end)); \
exit
}' $FAXFILE`
fi
if [ "$TELEFON" = "" ]; then
TELEFON=`awk '$3 == "(F)A"{getline;if($3 != "(a)A")next
getline;if($3 != "(x)A")next
getline;if($3 != "(-)A")next
getline;if($3 != "(N)A")next
getline;if($3 != "(o)A")next
getline;if($3 != "(:)A")next
getline;gsub(/[ -()A]/,"",$3);print $3;exit
}' $FAXFILE`
fi
#
# if we have a fax number, send the fax
#
if [ "$TELEFON" = "" ];
then
echo "Fax number not found !" | \
$MAILER -s "Problem with FaxFilter" $Mailname
rm $FAXFILE
else
faxspool -u $Username -f $Username $TELEFON $FAXFILE 2>&1 | \
$MAILER -s "Fax spooled to $TELEFON." $Mailname
rm $FAXFILE
fi
exit 0
###########################################################################
========================================================================
Stephen Davies Consulting scldad@sdc.com.au
Adelaide, South Australia. Voice: 041-980 1417
Computing & Network solutions. Fax: 08-82728863