home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mskscripts / generic.kds < prev    next >
Text File  |  2020-01-01  |  3KB  |  108 lines

  1. ; FILE GENERIC.SCR
  2. ;
  3. ; An MS-DOS Kermit script program for dialing a generic high-speed modem
  4. ; that uses the AT command set and supports RTS/CTS flow control.  Tone
  5. ; dialing is used -- change the ATDT command if ncecessary.
  6. ;
  7. ; To use: SET MODEM=GENERIC (in DOS, before starting Kermit)
  8. ; or:     DEFINE _MODEM GENERIC (in Kermit, before dialing)
  9. ; and:    Make sure Kermit executes the standard MSKERMIT.INI file.
  10. ;
  11. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, October 1997.
  12. ;
  13. if < VERSION 315 stop 1 Sorry - MS-DOS Kermit 3.15 or later required.
  14.  
  15. define errfail hangup, stop 1 \%1 ; Macro to handle failures.
  16. define chkerr if fail stop 1 \%1
  17. define chkok input 3 OK, if fail stop 1 \%1
  18.  
  19. set carrier OFF                 ; Don't require carrier during dialing.
  20.  
  21. declare \&s[7]            ; Array of speeds to try.
  22. def \&s[1] 57600        ; 115200 is not reliable so we don't try it.
  23. def \&s[2] 38400
  24. def \&s[3] 19200
  25. def \&s[4] 9600
  26. def \&s[5] 2400
  27. def \&s[6] 1200
  28. def \&s[7] 300
  29. assign \&s[0] \%1
  30.  
  31. set input echo on        ; So we can watch what happens.
  32. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  33. set input case ignore        ; Use caseless string comparisons
  34.  
  35. set parity none            ; Avoid parity foulups
  36. set flow none            ; Avoid flow control deadlocks
  37. hangup                ; Begin by dropping DTR
  38. pause 1                ; for one second
  39.  
  40. echo Configuring Generic high-speed modem on \v(line).
  41.  
  42. for \%i 1 7 1 {            ; Find a speed it recognizes
  43.     echo Trying \&s[\%i]...
  44.     set speed \&s[\%i]
  45.     if fail continue
  46.     output ATV1Q0\13
  47.     input 2 OK
  48.     if success forward INIT
  49. }
  50. stop 1 No response from modem - is it turned on and plugged in?
  51.  
  52. :INIT
  53. ;
  54. ; Command to reset modem.  Substitute AT&F, AT&F0, AT&F1, etc,
  55. ; if ATZ doesn't work.  The idea is to enable high-speed modulation,
  56. ; protocols, and fallback, as well as RTS/CTS hardware flow control.
  57. ;
  58. output ATZ\13                   ; Reset modem
  59. msleep 500
  60. input 5 OK
  61.  
  62. :BEGIN                ; Now DIAL.
  63. clear                ; Clear INPUT buffer.
  64. echo Dialing \&s[0] on \v(line) at \v(speed) bps, wait...
  65. set count 10                    ; How many times to redial
  66. forward dial                    ; 1st time, skip pause and Redialing message
  67.  
  68. :REDIAL
  69. output \13
  70. hangup
  71. set alarm 5
  72. pause 5             ; Wait 5 seconds before redialing.
  73. if not alarm errfail {Dialing canceled.}
  74. echo Redialing...
  75. pause 1
  76.  
  77. :DIAL
  78. echo Press any key to cancel...
  79. output ATDT\&s[0]\13            ; Dial the number.
  80. clear input                    ; Clear echo from INPUT buffer.
  81. minput 90 CONNECT BUSY ERROR {NO DIAL} {NO CARRIER} {NO ANSWER}
  82.  
  83. switch \v(minput) {
  84.   :0, end 1 Dialing canceled.
  85.   :1, break
  86.   :2, echo Line is busy - will redial in 5 seconds.
  87.       if count goto REDIAL
  88.       stop 1 Too many redials - please try again later.
  89.   :3, stop 1 Modem command error - Fatal.
  90.   :4, stop 1 No dialtone.  Is your phone connected to your modem?
  91.   :5, stop 1 No carrier.  Did you dial the right number?
  92.   :6, echo No answer - will dial again in 5 seconds.
  93.       if count goto REDIAL
  94.       stop 1 Too many redials - please try again later.
  95. }
  96. wait 1 CTS                      ; We have a connection
  97. xif success {
  98.     set flow rts/cts
  99.     echo Hardware flow control enabled.
  100.     msleep 250
  101. } else {
  102.     echo WARNING: CTS signal from modem not detected.
  103.     echo Hardware flow control NOT enabled - expect data loss.
  104. }
  105. end 0
  106.  
  107. ; End of GENERIC.SCR
  108.