
;            MAIL2.ASP  -  For Procomm Plus Version 2.01
;
;      Calls 2 BBSs at the same time everyday for up to 9 days


PROC MAIN
;**************** SET TIME and DAYS to DIAL the BBS******************
ASSIGN S6 ""                   ;TIME to start dial in 24-hr  "HH:MM"
                               ;(leave as "" for immediate execution)
N3=1                           ;the NUMBER of DAYS the script should
                               ;DIAL the BBSs.  MAXIMUM is 9 days.
                               ;(leave as 1 for a "daily" mail run)
;********************************************************************
N6=0
call xmr
ENDPROC

PROC XMR
   N5=0
   N7=0
   N8=0
   N9=0
   N6=N6+1
   if N6 > N3
      usermsg "   Script Completed!!   "
      quit
   endif
     STRING T2
     INTEGER C1=1
     CLEAR 30
       IF NULL S6
          C1=0
       ENDIF
     STATMSG " Waiting till specified time to execute BBS call ... "
     WHILE NOT ZERO C1
     T2=$TIME1
     FATSAY 4 25 14 "Time Set: "
     FATSAY 4 36 15 S6
     FATSAY 6 25 14 "Time Now: "
     FATSAY 6 36 15 T2
     STRCMP S6 T2 5
      IF SUCCESS
         C1 = 0
      ENDIF
     ENDWHILE
     call bbs1
ENDPROC

PROC BBS1
;*********** CUSTOMIZATION SECTION for FIRST BBS**********************
  ASSIGN S0 "x-xxx-xxx-xxxx"     ;BBS phone number 1
  ASSIGN S1 "x-xxx-xxx-xxxx"     ;BBS phone number 2
  ASSIGN S2 "xxxxxxxx"           ;your password
  ASSIGN S3 "xxxxx"              ;BBS code for REPs & QWKs (NODEID)
  ASSIGN S4 "David Lecin"        ;your FIRST and LAST name
  ASSIGN S5 "c:\rep\"            ;your REP directory
  ASSIGN S7 ""                   ;Language Number  ( ""  for NONE)
  N0=0                           ;Mail Door Number (PCBoard only)
  N1=0                           ; N1=1 - for QMail Door
                                 ; N1=2 - for MarkMail Door
                                 ; N1=2 - for Kmail Door
                                 ; N1=3 - for Wildcat/Tomcat
  ASSIGN S8 "N"                  ;TOMCAT command from Message Menu
  N2=0                           ; N2=0 for internal zmodem
                                 ; N2=1 for external protocol
;*********** End Customization Section 1 *****************************
N5=1
CALL TMR
ENDPROC

PROC BBS2
;*********** CUSTOMIZATION SECTION for SECOND BBS*********************
  ASSIGN S0 "x-xxx-xxx-xxxx"     ;BBS phone number 1
  ASSIGN S1 "x-xxx-xxx-xxxx"     ;BBS phone number 2
  ASSIGN S2 "xxxxxxxx"           ;your password
  ASSIGN S3 "xxxxx"              ;BBS code for REPs & QWKs (NODEID)
  ASSIGN S4 "David Lecin"        ;your FIRST and LAST name
  ASSIGN S5 "c:\rep\"            ;your REP directory
  ASSIGN S7 ""                   ;Language Number  ( ""  for NONE)
  N0=0                           ;Mail Door Number (PCBoard only)
  N1=0                           ; N1=1 - for QMail Door
                                 ; N1=2 - for MarkMail Door
                                 ; N1=2 - for Kmail Door
                                 ; N1=3 - for Wildcat/Tomcat
  ASSIGN S8 "N"                  ;TOMCAT command from Message Menu
  N2=0                           ; N2=0 for internal zmodem
                                 ; N2=1 for external protocol
;*********** End Customization Section 2 *****************************
N5=2
CALL TMR
ENDPROC

PROC TMR
   N4=1
     SET MODEM MAXDIAL 1
     EMULATE ANSI
     CLEAR 15
     FATSAY 1 22 30 "Press  ESCAPE  twice to cancel ....."
     SET PARITY NONE
     SET DATABITS 8
     SET STOPBITS 1
     SET DUPLEX FULL
   CALL ONE
ENDPROC

;Alternate Dialing the Two Nodes
PROC ONE
     MDIAL S0 S3
       IF NOT CONNECTED
          CALL TWO
       else
          N8=N8+1
          N9=N5
          call dzl
       ENDIF
 ENDPROC
PROC TWO
     MDIAL S1 S3
       IF NOT CONNECTED
          N4=N4+1
          IF N4 > 2
             CALL DZR
             ENDIF
          CALL ONE
       else
          N8=N8+1
          N9=N5
          call dzl
       ENDIF
 ENDPROC

PROC DZL
;Internal Variable Manipulation
  STRING S14
  ITOA N0 S14
  STRING S15
  ASSIGN S15 ".REP"
  S9=S3
  STRCAT S9 S15
  STRCAT S5 S3
  STRCAT S5 S15

;Flow Control - PCBoard or Wildcat BBS
 IF N1==1
    ELSEIF N1==2
    ELSEIF N1==3
      CALL WCAT
  ELSE
      quit
  ENDIF

;Basic PCBoard Prompts
   WHEN 0 "more?" transmit "n^M"
   WHEN 1 "continue" transmit "^M"
   WHEN 2 "(Enter)=yes?" transmit "n^M"

;Language Prompt Response
   IF NULL S7
     ELSE
       waitfor "language" 180
       transmit S7
       transmit "^M"
   ENDIF

;PCBoard Logon and Open MailDoor
   waitfor "ics (Enter)=no? " 150
   transmit "Y;Q^M"
   waitfor "our first name? " 60
   transmit S4
   transmit "^M"
   waitfor "s will echo)? (" 60
   transmit S2
   transmit "^M"
   waitfor " Board Command? " 120
   transmit "open "
   transmit S14
   transmit "^M"

;Upload REP Packet
   findfirst S5
    if found
       waitfor "Command?" 300
       transmit "U^M"
       waitfor S9 300
       sendfile zmodem S5
            if success
                delete S5
            endif
     endif

   WAITFOR "Command?" 300

;Flow Control - Mail Door
 IF N1==1
      CALL QM
   ELSEIF N1==2
      CALL MM
   ELSE
      TRANSMIT "G^M"
  ENDIF

ENDPROC

;QMail Door
  PROC QM
      transmit "D;Y;G^M"
      when 0 "Prepare to download" call DZL2
      when 2 "Command?" transmit "G^M"
      WHILE CONNECTED
      ENDWHILE
      call dzr
  ENDPROC
  PROC DZL2
     if N2==1
         dos "xfer"
      endif
  ENDPROC

; If you use an external protocol, the batch file "xfer.bat" must be
; in your PCPLUS directory.

;MarkMail or Kmail Doors (same prompts/replies)
  PROC MM
      transmit "d^M"
      when 2 "Do you want to" call DZL3
      when 0 "Command?" transmit "G^M"
      WHILE CONNECTED
      ENDWHILE
      call dzr
  ENDPROC
  PROC DZL3
      transmit "Y^M"
      waitfor ".QWK" 300
        if N2==1
           dos "xfer"
         endif
  ENDPROC

;WILDCAT! TOMCAT!  Section
PROC WCAT
;Logon and GoTo Tomcat
  WHEN 0 "ontinue" transmit "^M"
  WAITFOR "first name" 180
    TRANSMIT "*"
    TRANSMIT S4
    TRANSMIT " "
    TRANSMIT S2
    TRANSMIT "^M"
  WAITFOR "Main Menu" 180
    TRANSMIT "M^M"
  WAITFOR "Message Menu" 180
    TRANSMIT S8
    TRANSMIT "^M"

;Upload REP
  findfirst S5
    if found
       waitfor "TOMCAT MENU" 300
       transmit "U^M"
       waitfor S9 300
       sendfile zmodem S5
            if success
                delete S5
            endif
    endif

;Download QWK
  WAITFOR "TOMCAT MENU" 300
    transmit "d^M"
  WHEN 1 "would you like to receive this packet" call TOM1
  WHEN 2 "tomcat menu" transmit "G^M"
  WHILE CONNECTED
  ENDWHILE
  call dzr

ENDPROC

PROC TOM1
   transmit "Y^M"
   waitfor ".QWK" 360
     if N2==1
       dos "xfer"
      endif
ENDPROC

;Rename and Move QWK to storage directory
;Make sure the BATCH file "store.bat" is in your PC+ directory!

PROC DZR

 if N9==N5
  if n6==1
      dos "store 1"
    elseif n6==2
      dos "store 2"
    elseif n6==3
      dos "store 3"
    elseif n6==4
      dos "store 4"
    elseif n6==5
      dos "store 5"
    elseif n6==6
      dos "store 6"
    elseif n6==7
      dos "store 7"
    elseif n6==8
      dos "store 8"
    elseif n6==9
      dos "store 9"
  endif
 endif

  N7=N7+1
  if N7 > 100
     call xmr
     endif
  if N8==2
     call xmr
     endif
  if N9==2
     call bbs1
     endif
  if N9==1
     call bbs2
     endif

  if N9==0
     if N5==1
        call bbs2
     elseif N5==2
        call bbs1
     endif
  endif

ENDPROC

