home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR11
/
MAIL2FX2.ZIP
/
SENDFAX.PPS
< prev
next >
Wrap
Text File
|
1993-09-18
|
9KB
|
238 lines
;*────────────────────────────────────────────────────────────────────────────*
; Script to allow user to enter a message to be faxed.
; We gather the message envelope info, pre-validate information and put
; the user into the editor.
;
; Author Frans van Duinen
; Copyright 1993, Master Programmer Group
; Telephone 416 588-0698
; BBS 416 588-3821
;
; Original FVD 9 Aug 93
; Modified FVD 2 Sep Added @ATTN line
; 4 Sep Fixed some formatting, added alias file
; 6 Sep Added ? support to show alias file
;
; This script is intended for use with my Mail2Fax program, which scans
; all messages in a PcBoard message database to identify those it needs
; to extract for processing (those sent TO: FAX MAIL )
; Mail2Fax does more complete validation of the fax number, but we catch
; the most blantant ones at time of entry.
;
; Outline of script
; Display what this script does, ask confirm
; explain process, ask if text upload
; Join fax conference
; Ask Fax no, addressee name & telephone (address), subject
; Invoke editor & enter values by stuffing keyboard buffer.
; exit via editor
; At fax no prompt we accept fax no, alias name or ?. Fax number and
; alias are validated.
;
; The alias file must have 1 alias and 1 fax number per line (alias first).
; The alias may have embedded blanks, but the first character must be
; alphabetic and it must be in all upper case. The fax number may be
; formatted. E.g.
; WORLD WIDE 1(800) 555-1211
; LOCAL 555-1213
;
; We suppport local and netmail faxes
; There is a known bug in that KBDSTUF Chr(255) does not appear to work.
; This results in an improperly constructed extended header (ATTENTN)
; MAIL2FAX.EXE tests for this case.
;*────────────────────────────────────────────────────────────────────────────*
String cConf, cLdOk
String Answer, FaxPhone, ToName, Subject, cReqRr
String cGetLn
String cFaxAlias
String cEchoFaxOk, cEchoMsg, cEchoConf
String cFaxId ; Fax mail or some BBS's NETID
Integer i, j, nSelect
GetToken cConf ; What conference is Fax mail
GetToken cLdOk ; Is long distance allowed
GetToken cEchoConf ; Is this an echo mail conference
cEchoMsg = "N" ; By default message is local
cFaxId = "FAX MAIL"
cFaxAlias = "FAXALIAS.TXT"
PrintLn
println "@X5FThis command allows you to enter a message that is to be sent via FAX@X0F"
println
Answer = ""
inputyn "Is that what you want to do", Answer, 0Eh
if (Answer <> YesChar()) goto NoFax
Log "Fax Invoked", True
println
println "@X38┌────────────────────────────────────────────────────────────────────────────@X3B┐@X0F"
println "@X38│@X3E This command allows you to enter a message that will be sent via FAX. @X3B│@X0F"
println "@X38│@X3E @X3B│@X0F"
println "@X38│@X3E You'll need to provide the Fax number and the name of the person or @X3B│@X0F"
println "@X38│@X3E company that you'll be sending this to. @X3B│@X0F"
println "@X38│@X3E The fax number must be 7 digits (Metro Toronto only), or a valid Alias. @X3B│@X0F"
println "@X38│@X3E (See the bulletin for a list of aliasses.) @X3B│@X0F"
println "@X38│@X3E @X3B│@X0F"
println "@X38│@X3E Please note that this is for OUTBOUND faxing only. We have no provisions @X3B│@X0F"
println "@X38│@X3E to Receive faxes for you. @X3B│@X0F"
println "@X38│@X3E @X3B│@X0F"
println "@X38│@X3E Our Fax Mail system will send you a reply message if it was unable to @X3B│@X0F"
println "@X38│@X3E transmit your fax successfully. @X3B│@X0F"
println "@X38│@X3E @X3B│@X0F"
println "@X38│@X3E Faxes are sent about every hour. @X3B│@X0F"
println "@X38└@X3B────────────────────────────────────────────────────────────────────────────┘@X0F"
println
FaxPhone = ""
ToName = ""
Subject = ""
:AskQuestions
println
; #### Test if cEchoFax and prompt for Calling area/NPA
; present list of participating systems, calling area and BBS ID
; Set cFaxId to Het Fax ID for that BBS.
; If net fax ID in use, ask for full TN (not alias)
println "Enter fax number to send fax to, or alias name, ? for list"
InputText "Fax number, alias (or ?)", FaxPhone, 0Eh, 14
FreshLine
If (Len( lTrim( FaxPhone, " ")) = 0) Then
inputyn "Abort FAX entry", Answer, 0Eh
if (Answer = YesChar()) goto NoFax
Endif
If (FaxPhone = "?") Then
PrintLn " The defined Fax Aliasses are"
DispFile cFaxAlias, 0
goto AskQuestions
Endif
Answer = Strip( Strip( Strip( Strip( FaxPhone, " "), ")"), "("), "-")
IF (Left( Answer, 1) < "0" || Left( Answer, 1) > "9") Then
fOpen 1, cFaxAlias, O_RD, S_DN
i = 1
j = 0 ; If zero on loop exit - no match
Answer = " " + Upper( FaxPhone) + " "
While (! fErr( 1)) Do
Fget 1, cGetLn
j = Instr( Upper( cGetLn), Answer)
IF (j <> 0) Then
; PrintLn cGetLn, j
Goto FoundAlias
Endif
Inc i
EndWhile
:FoundAlias
fClose 1
IF (j = 0) Then
PrintLn "@X34Not a valid fax number or alias@X0F"
Goto AskQuestions
Endif
; We have a match in alias file
j = j + Len( Answer)
Answer = Mid( cGetLn, j, Len( cGetLn) - J+1)
; PrintLn Strip( Answer, " ")
; FaxPhone = Strip( Answer, " ") ; Remove leading blanks
; Note, we actually store the alias here. This allows Mail2Fax to see the
; alias and translate it to a fax number w/o further validation.
Else
; Numeric
IF (cLdOk = "N") Then ; Local # only
IF (Len( Answer ) <> 7 ) Then
PrintLn "@X34Seven digit fax numbers only@X0F"
Goto AskQuestions
Endif
IF (Left( Answer, 1) = "1" || Left( Answer, 1) = "0") Then
PrintLn "@X34Local fax numbers only@X0F"
Goto AskQuestions
Endif
Answer = Left( Answer, 3)
IF (Instr( "411~611~911~976~", Answer + "~") <> 0) Then
PrintLn "@X34" + Answer + " is not a valid fax number@X0F"
Goto AskQuestions
Endif
Else
IF (Len( Answer ) < 7 || Len( Answer ) > 11 || Len( Answer ) = 9) Then
PrintLn "@X34Wrong number of digits@X0F"
Goto AskQuestions
Endif
IF (Len( Answer ) = 7) Then
Answer = Left( Answer, 3)
Else IF (Len( Answer ) = 8) Then
Answer = Mid( Answer, 2, 3)
Else IF (Len( Answer ) = 10) Then
Answer = Mid( Answer, 4, 3)
Else IF (Len( Answer ) = 11) Then
Answer = Mid( Answer, 5, 3)
Endif Endif Endif Endif
IF (Instr( "411~611~911~976~", Answer + "~") <> 0) Then
PrintLn "@X34" + Answer + " is not a valid fax number@X0F"
Goto AskQuestions
Endif
Endif
Endif
println
println "@X0BPlease enter the following for the fax's cover sheet@X0F"
println
inputtext "To whose attention ", ToName, 0Eh, 25
println
Println
InputText "What is the subject ", Subject, 0Eh, 25
FreshLine
If (Len( lTrim( Subject, " ")) = 0) Then
inputyn "Abort FAX entry", Answer, 0Eh
if (Answer = YesChar()) goto NoFax
Endif
:ReqRR
Println
PrintLn "@X0BShould we notify you if the FAX:@X0F"
PrintLn "@X0B 1 - could not be delivered, or@X0F"
PrintLn "@X0B 2 - in all cases@X0F"
nSelect = "1"
InputStr "@X0B (1 or 2) ", nSelect, 0Eh, 1, "12", NEWLINE
IF (nSelect <> 2 && nSelect <> 1) Then
PrintLn "@X34Enter 1 or 2 only - Please re-enter@X0F"
GoTo ReqRr
Endif
cReqRr = "N"
IF (nSelect = 2) Then
cReqRr = "Y"
Endif
println
Answer = ""
InputYn "Is the above information correct", Answer, 0Eh
println
if (Answer <> YesChar()) goto askquestions
Join cConf ; Fax Mail Conference
Log "Fax Edit", True
println
println "@X0BWe will now invoke the editor to allow you to enter the@X0F"
println "@X0Btext for your fax. Use Editor's U command to UPLOAD text.@X0F"
kbdstuff "E" + Chr( 13)
kbdstuff cFaxId + " @" + FaxPhone + Chr( 13)
kbdstuff Subject + Chr( 13)
IF (cEchoFaxOk = "Y") Then
kbdstuff cEchoMsg + Chr( 13) ; Echo message y/n
Endif
kbdstuff cReqRr + Chr( 13) ; Reply requested y/n
KbdStuff Chr( 255) + Chr( 255) + "@ATTENTN:"
KbdStuff Left( ToName + Space( 59), 60) + "N" + Chr( 13)
:NoFax
end
;*────────────────────────────────── eof ─────────────────────────────────────*