home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msr313src.zip / msmdatap.scr < prev    next >
Text File  |  1993-09-08  |  5KB  |  136 lines

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