home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msr313src.zip / msmc144p.scr < prev    next >
Text File  |  1994-01-10  |  6KB  |  141 lines

  1. ; FILE CONN144P.SCR (MSMC144P.SCR)
  2. ; An MS-DOS Kermit script program for dialing the Digicom Connection 144+
  3. ; (previously known as the Connection 96+; there is no functional difference)
  4. ; 14400 modem, to be used with MS-DOS Kermit 3.12 or later.  The modem is set
  5. ; for V.32bis, compression, error correction (if appropriate software loaded),
  6. ; RTS/CTS flow control, fixed interface speed of 115200, 57600, or 38400.
  7. ; NOTE: Compression is enabled only if DATA144B software is loaded in the 
  8. ; modem.  Do not use %C1 to enable compression, because the modem will
  9. ; malfunction if this command is given but DATA144B is not loaded (if it is
  10. ; loaded, compression will be enabled automatically anyway).
  11. ;
  12. ; Rename this file to CONN144P.SCR if necessary.
  13. ;
  14. ; To use: SET MODEM=CONN144P (in DOS, before starting Kermit)
  15. ; or:     DEFINE _MODEM CONN144P (in Kermit, before dialing)
  16. ; and:    Make sure Kermit executes the standard MSKERMIT.INI file.
  17. ;
  18. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, September 1993
  19. ; Adapted from DATAPORT.SCR by Mike Long; January 1994
  20. ;
  21. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  22. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  23. if eq "\v(system)" "UNIX" if = \v(local) 0 stop 1 You must SET LINE first
  24.  
  25. define chkerr if fail stop 1 \%1
  26. define chkok input 3 OK, if fail stop 1 \%1
  27.  
  28. set input echo on               ; So we can watch what happens.
  29. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  30. set input case ignore           ; Use caseless string comparisons
  31.  
  32. set parity none                 ; Avoid parity foulups
  33. set flow none                   ; Avoid flow control deadlocks
  34. hangup                          ; Begin by dropping DTR
  35. pause 1                         ; for one second
  36.  
  37. ; Speed.  Don't worry about modem, it autobauds up to 115200 bps.
  38. ;
  39. set speed 57600                 ; If computer can be set to 57600 bps, use it.
  40. if fail set speed 38400         ; If not, use 38400.
  41.  
  42. wait 0 DSR                      ; Check modem signals that should be on
  43. chkerr {No DSR signal - check your modem}
  44. wait 0 CTS
  45. chkerr {No CTS signal - check your modem}
  46.  
  47. echo Configuring Digicom Connection 144+ on \v(line).\13\10
  48.  
  49. :INIT
  50. output ATQ0V1\13                ; Enable word result codes
  51. chkok {Can't get modem's attention}
  52. ; E1 = Echo commands
  53. ; W0 = Don't show error correction & compression status
  54. ; X4 = Verbose result codes, show modulation speed
  55. ; &C1 = CD follows RS232
  56. ; &D2 = DTR follows RS232
  57. output ATE1W1X4&C1&D2\13
  58. chkok {Can't initialize modem}
  59. output AT&K3\13                 ; RTS/CTS hardware flow control
  60. chkok {Can't enable RTS/CTS}    ; On modem
  61. set flow rts/cts                ; And in Kermit too, but only now
  62. output AT\92N5\13               ; Auto-reliable V.42, and V.42bis enabled
  63. chkok {Can't enable compression or error correction}
  64. output AT&V\13                  ; Show modem configuration
  65. chkok {Can't display configuration}
  66. echo Firmware version:\13\10
  67. output ATI3\13                  ; Show modem software version
  68. chkok {Can't determine modem software version}
  69.  
  70. if def \%1 if not equal "\%1" "=" goto BEGIN
  71. echo Modem initialization complete, no number to dial
  72. end 0
  73.  
  74. :BEGIN                          ; Now DIAL.
  75. clear                           ; Clear INPUT buffer.
  76. set count 5                     ; Dialing retry counter, 5 tries allowed.
  77. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  78. echo
  79. pause 1
  80. goto dial                       ; 1st time, skip pause and Redialing message
  81.  
  82. :REDIAL
  83. set alarm 30
  84. pause 30                        ; Wait 30 seconds before redialing.
  85. if not alarm errfail {Dialing canceled.}
  86. echo Redialing...               ; Message for redialing.
  87. pause 1
  88.  
  89. :DIAL
  90. output ATD\%1\13                ; Dial the number.
  91. set alarm 90                    ; (For detecting keyboard interruptions.)
  92. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  93. if < VERSION 313 clear
  94. input 30 \10                    ; Wait for the linefeeds...
  95.  
  96. :GETMSG
  97. input 60 \10                    ; ...that surround the response message.
  98. if success goto gotmsg          ; Got a message.
  99. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  100. hangup                          ; User interrupted from keyboard,
  101. output \13                      ; cancel dialing by sending carriage return,
  102. goto again                      ; and go try again right away.
  103.  
  104. :GOTMSG
  105. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  106. if success goto done            ; If so, we're done.
  107. reinput 1 BUSY                  ; Line is busy.
  108. if success goto busy            ; Go wait a while and then dial again.
  109. reinput 1 ERROR                 ; Command syntax error.
  110. if success errfail {Dialing command error}
  111. reinput 1 NO CARRIER            ; Phone didn't answer or no carrier.
  112. if success errfail {No answer or no carrier}
  113. reinput 1 NO ANSWER             ; No answer
  114. if success errfail {No answer - try again later}
  115. reinput 1 NO DIALTONE           ; No dialtone when phone taken off hook.
  116. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  117. goto getmsg                     ; None of the above, get another message.
  118.  
  119. :BUSY
  120. if < \v(count) 2 goto quit      ; Don't wait 30 seconds if tries are used up.
  121. Echo Line is busy, will dial again in 30 seconds.
  122. echo Press any key to cancel...
  123. output \13                      ; CR cancels dialing
  124. hangup                          ; Hang up.
  125. :AGAIN
  126. if count goto redial            ; Then go redial.
  127. :QUIT
  128. errfail {It never answers!  I give up.} ; Too many tries.
  129.  
  130. :DONE                           ; Connected.
  131. echo \7                         ; Celebrate with a beep.
  132. define errfail                  ; Erase local macro definitions...
  133. end 0                           ; Finished, return success code.
  134.  
  135. :FAIL                           ; Dialing failed, no beep.
  136. define errfail                  ; Erase local macro definitions...
  137. end 1                           ; Return failure code.
  138.  
  139. ; End of CONN144P.SCR
  140.