home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR31 / KERM313.ZIP / MT1432.SCR < prev    next >
Text File  |  1993-07-07  |  5KB  |  132 lines

  1. ; FILE MT1432.SCR (MSMT1432.SCR)
  2. ;
  3. ; An MS-DOS Kermit script program for dialing the Multitech MT1432 series 
  4. ; modems, to be used with MS-DOS Kermit 3.12 or later.  The modem is set 
  5. ; for compression, error correction, all types of fallback, RTS/CTS 
  6. ; flow control, and a fixed interface speed of 57600 or 38400.
  7. ;
  8. ; Authors: Christine M. Gianone, Frank da Cruz, Max Evarts; 
  9. ; Columbia University, June 1993
  10. ;
  11. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  12. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  13. if eq "\v(system)" "UNIX" if = \v(local) 0 stop 1 You must SET LINE first
  14.  
  15. define chkerr if fail stop 1 \%1
  16. define chkok input 3 OK, if fail stop 1 \%1
  17.  
  18. set input echo on        ; So we can watch what happens.
  19. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  20. set input case ignore        ; Use caseless string comparisons
  21.  
  22. set parity none            ; Avoid parity foulups
  23. set flow none            ; Avoid flow control deadlocks
  24. hangup                ; Begin by dropping DTR
  25. pause 1                ; for one second
  26.  
  27. ; Speed.  Don't worry about modem, it autobauds up to 57600.
  28.  
  29. set speed 57600            ; If computer can be set to 57600 bps, use it.
  30. if fail set speed 38400        ; If not, use 38400.
  31.  
  32. echo Configuring MultiTech MT1432 on \v(line).
  33.  
  34. wait 0 DSR            ; Check modem signals that should be on
  35. chkerr {No DSR signal - check your modem and cable}
  36. wait 0 CTS
  37. chkerr {No CTS signal - check your modem and cable}
  38.  
  39. :INIT
  40. output ATQ0V1\13        ; Enable word result codes
  41. chkok {Can't get modem's attention}
  42.  
  43. output AT E1 &Q1 X4\13        ; Echoing, result codes, etc.
  44. chkok {Can't initialize modem}
  45.  
  46. echo Enabling modulation negotiation...
  47. output AT $SB\v(speed) $MB14400\13    ; Start modulation speed negotiation
  48.                     ; at V32bis, set interface speed
  49. chkok {Can't enable modulation speed negotiation}
  50. echo Enabling hardware flow control...
  51. output AT &E4\13        ; RTS/CTS hardware flow control
  52. chkok {Can't enable RTS/CTS}    ; On modem
  53. set flow rts/cts        ; And in Kermit too, but only now
  54. echo Configuring modem to ignore BREAK...
  55. output AT %E1\13        ; Make modem ignore BREAK
  56. chkok {Can't become transparent to BREAK}
  57. echo Enabling error correction and data compression...
  58. output AT &E1 &E15 $BA0\13    ; Enable error correction & compression
  59.                 ; with automatic speed buffering 
  60. chkok {Can't enable compression EC and fallback}
  61.  
  62. if def \%1 if not equal "\%1" "=" goto BEGIN
  63. echo Modem initialization complete, no number to dial
  64. end 0
  65.  
  66. :BEGIN                ; Now DIAL.
  67. clear                ; Clear INPUT buffer.
  68. set count 5                     ; Dialing retry counter, 5 tries allowed.
  69. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  70. echo
  71. pause 1
  72. goto dial                       ; 1st time, skip pause and Redialing message
  73.  
  74. :REDIAL
  75. set alarm 30
  76. pause 30            ; Wait 30 seconds before redialing.
  77. if not alarm errfail {Dialing canceled.}
  78. echo Redialing...               ; Message for redialing.
  79. pause 1
  80.  
  81. :DIAL
  82. output ATD\%1\13                ; Dial the number.
  83. set alarm 90            ; (For detecting keyboard interruptions.)
  84. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  85. if < VERSION 313 clear
  86. input 30 \10                    ; Wait for the linefeeds...
  87.  
  88. :GETMSG
  89. input 60 \10            ; ...that surround the response message.
  90. if success goto gotmsg        ; Got a message.
  91. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  92. hangup                ; User interrupted from keyboard,
  93. output \13            ; cancel dialing by sending carriage return,
  94. goto again            ; and go try again right away.
  95.  
  96. :GOTMSG
  97. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  98. if success goto done            ; If so, we're done.
  99. reinput 1 BUSY            ; Line is busy.
  100. if success goto busy        ; Go wait a while and then dial again.
  101. reinput 1 ERROR            ; Command syntax error.
  102. if success errfail {Dialing command error}
  103. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  104. if success errfail {No answer or no carrier}
  105. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  106. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  107. goto getmsg            ; None of the above, get another message.
  108.  
  109. :BUSY
  110. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  111. echo Line is busy, will dial again in 30 seconds.
  112. echo Press any key to cancel...
  113. output \13            ; CR cancels dialing
  114. hangup                          ; Hang up.
  115. :AGAIN
  116. if count goto redial            ; Then go redial.
  117. :QUIT
  118. errfail {It never answers!  I give up.} ; Too many tries.
  119.  
  120. :DONE                           ; Connected.
  121. echo \7                         ; Celebrate with a beep.
  122. define errfail            ; Erase local macro definitions...
  123. end 0                ; Finished, return success code.
  124.  
  125. :FAIL                ; Dialing failed, no beep.
  126. define errfail            ; Erase local macro definitions...
  127. end 1                ; Return failure code.
  128.  
  129. ; End of MT1432.SCR
  130.  
  131.  
  132.