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

  1. ; FILE INTEL14.SCR (MSMINTEL.SCR)
  2. ; An MS-DOS Kermit script program for dialing the Intel High-Speed Internal
  3. ; Faxmodem, to be used with MS-DOS Kermit 3.14 or later.  The modem is set up
  4. ; for compression, error correction, all types of fallback.  RTS/CTS flow
  5. ; control, fixed interface speed of 57600 or 38400.
  6. ;
  7. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, October 1994.
  8. ;
  9. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  10. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  11.  
  12. define chkerr if fail stop 1 \%1
  13. define chkok input 3 OK, if fail stop 1 \%1
  14.  
  15. ; Macro to try to get attention of modem's command processor
  16. ; at the given speed, or if no speed given, at the current speed.
  17. ;
  18. define atok -
  19.  if not def \%1 assign \%1 \v(speed), -
  20.  set speed \%1, -
  21.  echo Trying \%1..., -
  22.  output ATQ0V1\13, -
  23.  input 3 OK, -
  24.  end \v(status)
  25.  
  26. set input echo on        ; So we can watch what happens.
  27. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  28. set input case ignore        ; Use caseless string comparisons
  29.  
  30. set parity none            ; Avoid parity foulups
  31. set flow none            ; Avoid flow control deadlocks
  32. hangup                ; Begin by dropping DTR
  33. pause 1                ; for one second
  34.  
  35. atok 57600            ; Autobaud...
  36. if fail atok 38400
  37. if fail atok 19200
  38. if fail atok 9600
  39. if fail stop 1 Can't get modem's attention.
  40.  
  41. def atok
  42. output AT E1&C1&D2&S0X4\92V2\13 ; Echoing, result codes, etc.
  43. chkok {Can't initialize modem}
  44.  
  45. echo Configuring Intel Faxmodem...
  46. out ATB1+FCLASS=0 S7=85 S25=50\13
  47. chkok {Can't set data modulation}
  48. echo Enabling hardware flow control...
  49. output AT \92G0\92Q3\13        ; Maybe substitute G1 for G0?
  50. chkok {Can't enable RTS/CTS}
  51. wait 5 cts
  52. if fail errfail {Modem is not asserting CTS!}
  53. set flow rts/cts 
  54. echo Configuring modem to ignore BREAK...
  55. output AT Y0\92K1\13
  56. chkok {Can't become transparent to BREAK}
  57. echo Enabling error correction and data compression...
  58. output AT \92J0\92N3%C1"H3\13
  59. chkok {Can't enable compression EC and fallback}
  60.  
  61. if def \%1 if not equal "\%1" "=" goto BEGIN
  62. echo Modem initialization complete, no number to dial
  63. end 0
  64.  
  65. :BEGIN                ; Now DIAL.
  66. clear                ; Clear INPUT buffer.
  67. set count 5                     ; Dialing retry counter, 5 tries allowed.
  68. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  69. echo
  70. pause 1
  71. goto dial                       ; 1st time, skip pause and 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...               ; Message for redialing.
  78. pause 1
  79.  
  80. :DIAL
  81. output ATD\%1\13                ; Dial the number.
  82. set alarm 90            ; (For detecting keyboard interruptions.)
  83. clear input            ; Clear echo from INPUT buffer.
  84. input 30 \10                    ; Wait for the linefeeds...
  85.  
  86. :GETMSG
  87. input 60 \10            ; ...that surround the response message.
  88. if success goto gotmsg        ; Got a message.
  89. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  90. hangup                ; User interrupted from keyboard,
  91. output \13            ; cancel dialing by sending carriage return,
  92. goto again            ; and go try again right away.
  93.  
  94. :GOTMSG
  95. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  96. if success goto done            ; If so, we're done.
  97. reinput 1 BUSY            ; Line is busy.
  98. if success goto busy        ; Go wait a while and then dial again.
  99. reinput 1 ERROR            ; Command syntax error.
  100. if success errfail {Dialing command error}
  101. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  102. if success errfail {No carrier}
  103. reinput 1 NO ANSWER        ; No answer
  104. if success errfail {No answer}
  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. def errfail            ; Erase local macro definitions...
  123. end 0                ; Finished, return success code.
  124.  
  125. :FAIL                ; Dialing failed, no beep.
  126. def errfail            ; Erase local macro definitions...
  127. end 1                ; Return failure code.
  128.  
  129. ; End of INTEL14.SCR
  130.