TIP: Click on subject to list as thread! ANSI
echo: qmodem_user
to: LOU BOEHLEIN
from: FRED HALL
date: 1995-09-06 15:31:00
subject: Strings

In a message to All , Lou Boehlein said: 
LB>Help. I'm running a small religious bbs and am trying to set QMODEM 4.3
LB>to run a script for getting QWK packets. It works well except when the
LB>host isn't available, etc. How (after digging in the docs and getting n
LB>where) can I limit the number of tries that the program tries to dial
LB>out? Any help would be appreciated.
LB>Tnx Fr Lou
The following is the script I used for Qmodem/DOS...it's more complicated 
than what you asked for since it dialed 2 BBS's (ping-ponging between them 
if they were busy), then ran a separate script when it connected...make 
sure you put a RETURN in the called script, not an END.  Modify it as you 
need.
======================
; MBBS3.SCR
; written by: FGH
; Script to Ping-Pong Dial two BBS's and run their
; associated mail scripts.  Also Sets a maximum number
; of total dial attempts and total connect attempts
DECLARE_STRINGS:    ;
;*******************************************************
  STRING phone1   ; Phone1
  STRING phone2   ; Phone2
  STRING maxdial  ; Maximum attempts: dials
  STRING maxconn  ; Maximum attempts: handshake
  STRING fst_scr  ; Script for first BBS
  STRING scd_scr  ; Script for second BBS
  STRING done_fst ; Flag: First Script Executed
  STRING done_scd ; Flag: Second Script Executed
ASSIGN_STRINGS:     ;
;*******************************************************
  ASSIGN phone1     "245-3815"     ; <- Set phone # to dial 1st
;
  ASSIGN phone2     "865-4070"     ; <- Set phone # to dial 2nd
;
;  ASSIGN phone2     "736-7671"     ; <- Set phone # to dial 2nd 
;
;last phone2 is for Excaliber node 2. 
;IMPORTANT! Both phone1 and phone2 must have a phone # (even if
;same #) since if the 1st # is busy the 2nd # will be called  
;and vice versa.
; 
  ASSIGN fst_scr    "KADMAIL.SCR"
  ASSIGN scd_scr    "PWRBW.SCR"
  ASSIGN done_fst 0         ; Fist Script Done = False
  ASSIGN done_scd 0         ; Second Script Done = False
  ASSIGN maxdial    "200"   ; <- Set max attempts: dials
  ASSIGN maxconn    "10"    ; <- Set max attempts: handshake
  ASSIGN 0 0                ; Initialize counter: dials
  ASSIGN 1 0                ; Initialize counter: handshakes
  ASSIGN 2 0                ; Initialize    flag: MAIL
  ASSIGN 5 1                ; Initialize counter: dial rotation
  
DIAL_INITIALIZE:    ; *** (Sub)
;*********************************************
  PAUSE 5000
  HANGUP                     ; Drop any prior connection
;  WAITFOR "OK"
  CLRSCR                     ; Clear screen
  PAUSE 1000  ;wait 1sec before init
 
  SEND "AT&B1&N0&H1&K3&A1&M4&I0&R2S10=15V1X4S27=32^M"  ;modem init
  PAUSE 1000  ;wait 1sec to re-init modem
  IF "$0" = "$maxdial"  DIAL_DONE   ; Check max # of dial attempts
  INCR 0                     ; Increase dial counter by 1
  DISPLAYLN "NUMBER OF DIAL ATTEMPTS = $0"
  IF "$1" = "$maxconn"  CONN_DONE   ; Check max # of handshake attempts
  IF $done_fst = "1" DIAL2   ; Already got mail from 1st BBS
  IF $done_scd = "1" DIAL1   ; Already got mail from 2nd BBS
DIAL_ROTATE:        ; --- Internal Label
;------------------------------------
  PAUSE 5000
  IF "$5" = "1" DIAL1    ;if counter = 1 go to dial 1
  IF "$5" = "2" DIAL2    ;if counter = 1 go to dial 2
  IF "$5" = "3" DIAL1    ;if counter = 3 go to dial 1
  DIAL1:
    ASSIGN 5 1            ; reset counter to 1 if = 3
;    SEND "ATDT$PHONE1^M"
; not needed for Sportster modem  SEND "ATE1Q0V1X4Z0^M"
  PAUSE 1000
  SEND "ATDT$PHONE1^M"
;    
    ; call phone1 (change to ATM0DT for quiet)
    INCR 5                ; Increase counter: dial rotation
    GOTO DIAL_CONNECT
  DIAL2:
    ASSIGN 5 2            ; reset counter to 2
;
;    SEND "ATDT$PHONE2^M" 
; Change Excalibur's init string and dial to force 9600 connection  
; because of quirk with Telepath modem (arrrgghhh!!)
;
;not necessary for Sportster modem    SEND "ATN0&Q5S37=9DT$PHONE2^M"
    SEND "ATDT$PHONE2^M"
         ; call phone2 (change to ATM0DT for quiet)
    INCR 5                 ; Increase counter: dial rotation
    GOTO DIAL_CONNECT
DIAL_CONNECT:       ; --- Internal Label
;------------------------------------
  WHEN                          ; Clear all WHENs
  WHEN "RING" dial_initialize   ; Redial if incoming call rings
  WHEN "BUSY" DIAL_INITIALIZE       ; Redial if busy
;  WHEN "NO DIALTONE" DIAL_INITIALIZE; Redial if no dial tone
  WHEN "NO CONNECT" DIAL_INITIALIZE ; Redial if no connect message
  WHEN "NO CARRIER" DIAL_INITIALIZE ; Redial if no carrier message
  WHEN "VOICE" DIAL_INITIALIZE      ; Redial if voice message
  TIMEOUT 60 DIAL_INITIALIZE  ; Redial if no carrier within 60 secs
  WAITFOR "CONNECT "          ; (keep 60 secs or can fail)
  INCR 1                      ; Increase handshake counter by 1
  DISPLAYLN "NUMBER OF HANDSHAKES=  $1"
  WHEN                        ; Clear all WHENs
; Note: The following line is commented out, it is supposed to
;       reject improper connects???
; WHEN " " DIAL_INITIALIZE
; Add or remove the ";" to the beginning of the connect line for
; the lowest speed you want to accept (example accepts 2400)
WHEN "CONNECT 300"  DIAL_INITIALIZE
; <- Reject any low speed connects
WHEN "CONNECT 1200" DIAL_INITIALIZE
; <- Reject any low speed connects
; WHEN "CONNECT 2400" DIAL_INITIALIZE
; <- Reject any low speed connects
; WHEN "CONNECT 4800" DIAL_INITIALIZE
; <- Reject any low speed connects
WHEN "NO CARRIER"   DIAL_INITIALIZE   ; Redial if carrier drops
SEL_SCRIPT:    ; ---Internal Label
;----------------------------------
  IF "$5" = "2" FIRST_SCRIPT     ; Call Script for First BBS
  IF "$5" = "3" SECOND_SCRIPT    ; Call Script for Second BBS
GOTO ALL_DONE
FIRST_SCRIPT:    ; --- Internal Label
;-------------------------------------
SCRIPT $fst_scr                     ; run first BBS script
ASSIGN done_fst 1                   ; set flag to indicate did mail run
IF $done_scd = "1"   ALL_DONE       ; if already did other mail run: done
GOTO DIAL_INITIALIZE                ; otherwise dial for 2nd BBS
SECOND_SCRIPT:    ; --- Internal Label
;--------------------------------------
SCRIPT $scd_scr                     ; run 2nd BBS script
ASSIGN done_scd 1                   ; set flag to indicate did mail run
IF $done_fst = "1"   ALL_DONE       ; if already did other mail run: done
GOTO DIAL_INITIALIZE                ; otherwise dial for first BBS
DIAL_DONE:
;------------------------------------
DISPLAYLN "MAX NUMBER OF DIALS EXCEEDED"
EXIT
CONN_DONE:
;-------------------------------------
DISPLAYLN "MAX NUMBER OF HANDSHAKES EXCEEDED"
EXIT
ALL_DONE:      ; --- Internal Label
;-----------------------------------
SYSTEM Y                            ; all done, drop carrier
EXIT                                ; exit to system
Fred  -- hallf@rl.af.mil -- powered by Win95 & Qmodem for Win95
... A well-crafted tagline is a joy forever.
 * Wave Rider 1.33 # 81 *
--- GEcho 1.11+
---------------
* Origin: PowerLine OLS 315.865.4070 Marcy NY (1:2609/2)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.