home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mskermit / msmva2400pa.scr < prev    next >
Text File  |  2020-01-01  |  5KB  |  151 lines

  1. ; File VA2400PA.SCR
  2. ;
  3. ; To be used with MS-DOS Kermit 3.11 or later.
  4. ;
  5. ; An MS-DOS Kermit script program for dialing Vadic 2400PA modems and
  6. ; compatibles.  Note that the once-popular Vadic 3451 is slightly different
  7. ; and will not work with this script except for internally-stored numbers.
  8. ;
  9. ;   -- WARNING:  This is no more than 95% debugged, and may not work 
  10. ;      properly in some fringe cases. --
  11. ;
  12. ; Stored in Kermit Distribution as MSMVA2400.SCR; rename to VA2400PA.SCR
  13. ; if necessary so the DIAL macro can find it.  Place this file in your
  14. ; current directory or in any directory in your DOS PATH, and then set the
  15. ; DOS environment variable, MODEM, to be VA2400PA.  Give the following command
  16. ; at the DOS prompt before starting Kermit, or add it to your AUTOEXEC.BAT
  17. ; file:
  18. ;
  19. ;   SET MODEM=VA2400PA
  20. ;
  21. ; Expects variable \%1 to contain the phone number or index number for number
  22. ; stored in the modem.  If actually providing a number, preceed it by "D".
  23. ; The number is normally provided by the DIAL macro defined in MSKERMIT.INI.
  24. ;  If you lack the DIAL macro definition, use this simple substitute:
  25. ;   DEFINE DIAL TAKE VA2400PA
  26. ; To use, just type DIAL Dnnnnnnn at the MS-Kermit> prompt, where nnnnnnn is
  27. ; the desired phone number.  Or type DIAL nn, where nn is the index for a
  28. ; number stored in the modem.
  29. ;
  30. ; The Vadic 2400PA is a pulse-only modem.
  31. ;
  32. ; Sets SUCCESS flag if dialing succeeds, sets FAILURE flag if it fails, for
  33. ; use with IF SUCCESS, IF FAILURE, \v(status).
  34. ;
  35. ;  Author: John C. Klensin, August 1992 (modified from HAYES.SCR by
  36. ;     Christine M. Gianone (July 1991).  MSKERMIT 3.11 or later.
  37. ;
  38. echo  Using Vadic 2400PA modem\13\10  ; Comforting in multimodem environment
  39. ;
  40. def errfail echo \%1,hangup,goto fail ; Macro to handle failures.
  41. ;
  42. if < VERSION 311 errfail {MS-DOS Kermit 3.11 or later required.}
  43. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE
  44. set input echo off        ; hide ^E interactions.
  45. ;
  46. hangup                ; Modem gets very confused if not started
  47. clear                           ; from a clear state.
  48. ;
  49. if not equ \%1 = goto dialnow   ; This provides for initialization only
  50. echo Modem initialization completed, no number to dial
  51. end 0
  52.  
  53. :DIALNOW
  54. ;  connect to, and dial, the modem - 05 decimal is control-E.
  55. ;  Try up to four times to get a response from control-E.  If not, give up.
  56. :reinitstar
  57. set count 4
  58. :getstar
  59. output \13
  60. output \05
  61. pause 0
  62. output \13
  63. input 2 *
  64. if SUCCESS goto dialnum
  65. if count goto getstar
  66. errfail {Modem not responding.  Turn on, connect, or manually reset it!}
  67.  
  68. :DIALNUM
  69. set input echo on        ; From now on, show responses
  70. echo \13\10Dialing \%1, wait...\13\10
  71. goto dial                       ; 1st time, skip Redialing message
  72.  
  73. :REDIAL
  74. set alarm 30
  75. pause 30            ; Wait 30 seconds before redialing.
  76. if not alarm errfail {Dialing canceled.}
  77. echo Redialing...
  78. pause 1
  79.  
  80. :DIAL
  81. output \%1            ; Have to talk slowly to the Vadic
  82. pause 0
  83. output \13
  84. set alarm 60            ; Detect keyboard interruptions.
  85. input 40 DIAL            ; First thing said is "Dialing"
  86.  
  87. :GETMSG
  88. input 40 \10            ; ending in LF
  89. if success goto gotmsg        ; Got a message.
  90. if alarm errfail {No response from modem.} ; No response in 60 secs.
  91. hangup                ; User interrupted from keyboard,
  92. goto reinitstar            ; so try again right away
  93.  
  94. :GOTMSG
  95. reinput 0 {ON LINE}             ; Got message, was it ONLINE?
  96. if success goto speed           ; Yes, go check the speed.
  97. reinput 0 {ANSWER TONE}        ; More noise
  98. if success goto getmsg
  99. reinput 0 RINGING        ; check for RINGING (not real Hayes).
  100. if success goto getmsg            ; RINGING, just wait for next message.
  101. reinput 0 DIALING        ; Got message.  Normally, first two are
  102. if success goto getmsg        ; just noise
  103. reinput 0 {NO CARRIER}        ; NO CARRIER?
  104. if success goto nocarrier    ; Hang up again, then start over
  105. reinput 0 {BUSY!}               ; BUSY?
  106. if success goto busy         ; Go wait a bit, then dial again.
  107. reinput 0 {INVALID COMMAND}       ; modem confused
  108. if success errfail {Modem returns 'invalid command'}
  109. reinput 0 {NO DIAL TONE}
  110. if success goto nodialtn
  111. errfail {No dialtone or no answer.  Try again later.}
  112.  
  113. :NODIALTN
  114. output I\13            ; try to explicitly place modem in IDLE
  115. errfail {No dialtone.  Try again later.}
  116.  
  117. :NOCARRIER
  118. hangup                ; try to clear modem, then retry
  119. clear
  120. goto reinitstar
  121.  
  122. :BUSY
  123. if < \v(count) 2 goto quit    ; Don't wait 60 seconds if tries used up.
  124. Echo Busy or No Carrier, will dial again in 30 seconds...
  125. echo Press any key to cancel...
  126. output \13            ; CR cancels dialing
  127. hangup                          ; Hang up.
  128. :AGAIN
  129. if count goto redial            ; Then go redial.
  130. :QUIT
  131. errfail {It never answers!  I give up.} ; Too many tries.
  132.  
  133. :SPEED                          ; Connected!
  134. echo \7                         ; Celebrate with a beep.
  135. reinput 0 1200                  ; Was the message ON LINE 1200?
  136. if success set speed 1200       ; Yes, change the speed.
  137. reinput 0 2400            ; Was it ON LINE 2400?
  138. if success set speed 2400    ; Yes, change speed.
  139. reinput 0 300            ; Try 300, just in case
  140. if success set speed 300    ; And set
  141. ;
  142. input 60 ERROR CONTROL
  143. if fail errfail {Can't get confirmation of error control} ; Give up
  144. ;
  145. define errfail            ; Erase ERRFAIL definition
  146. end 0                ; Finished, return success code.
  147.  
  148. :FAIL                ; Dialing failed.
  149. define errfail            ; Erase ERRFAIL definition
  150. end 1                ; Return failure code.
  151.