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

  1. ; FILE COMPAQ.SCR
  2. ; An MS-DOS Kermit script program for dialing the Compaq Internal Data+Fax
  3. ; 14400, 28800, or compatible modem, to be used with MS-DOS Kermit 3.15 or
  4. ; later.  The modem is set for RTS/CTS flow control, fixed interface speed,
  5. ; and to negotiate highest modulation, error correction, compression, and all
  6. ; types of fallback.
  7. ;
  8. ; Note: the manual contains no specific reference to error correction, data
  9. ; compression, speed buffering, hardware flow control, or BREAK transparency,
  10. ; so this is a just a best guess.
  11. ;
  12. ; Authors: C. Gianone & F. da Cruz, Columbia U, December 1996
  13. ;
  14. ; To use: SET MODEM=COMPAQ (in DOS, before starting Kermit or in AUTOEXEC.BAT)
  15. ; or:     SET MODEM COMPAQ (in Kermit, or in MSCUSTOM.INI)
  16. ; and:    Make sure Kermit has executed the standard MSKERMIT.INI file,
  17. ;         and then DIAL the desired number.
  18. ;
  19. ; Variables - define these prior to dialing if desired; they can be either
  20. ; Kermit variables or DOS environment variables:
  21. ;   DIALPORT    - COM port to use for dialing (COM1, COM2, etc)
  22. ;   DIALSPEED   - Speed for dialing (57600 by default)
  23. ;   DIALMETHOD  - TONE or PULSE (modem's default method is used by default)
  24. ;   DIALRETRIES - Maximum times to redial the call (default 5)
  25. ;   DIALTIMEOUT - How long to wait for result from modem (default 90 seconds)
  26. ;
  27. if < VERSION 315 stop 1 MS-DOS Kermit 3.15 or later required.
  28. def ERRFAIL echo \%1, forward FAIL
  29. def CHKOK input 3 OK, if fail stop 1 \%1
  30.  
  31. local __dm __parity        ; Local variables
  32. set carrier off                 ; Don't require carrier during dialing.
  33. set input echo on        ; So we can watch what happens.
  34. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  35. set input case ignore        ; Use caseless string comparisons
  36.  
  37. :PORT
  38. if not def DIALPORT asg DIALPORT \$(DIALPORT)
  39. if not def DIALPORT forward SPEED
  40. set port \m(DIALPORT)
  41. if success forward SPEED
  42. echo SET PORT \m(DIALPORT) failed 
  43. end 1
  44.  
  45. :SPEED
  46. asg __parity \v(parity)        ; Save parity setting
  47. set parity none            ; Switch to none while dialing
  48. set flow none            ; Avoid flow control deadlocks
  49. hangup                ; Begin by dropping DTR
  50.  
  51. if not def DIALSPEED asg DIALSPEED \$(DIALSPEED)
  52. if not def DIALSPEED asg DIALSPEED 57600
  53. set speed \m(DIALSPEED)
  54. if fail end 1 \m(DIALSPEED) - Speed not supported
  55.  
  56. ; Dial method, retry limit, and timeout...
  57.  
  58. xif numeric \fsubstr(\%1,1,1) {
  59.     if eq "\m(DIALMETHOD)" "TONE" asg __dm T
  60.     if eq "\m(DIALMETHOD)" "PULSE" asg __dm P
  61. }
  62. if not def DIALRETRIES asg DIALRETRIES \$(DIALRETRIES)
  63. if not def DIALRETRIES asg DIALRETRIES 5
  64.  
  65. if not def DIALTIMEOUT asg DIALTIMEOUT \$(DIALTIMEOUT)
  66. if not def DIALTIMEOUT asg DIALTIMEOUT 90
  67.  
  68. ; Begin the modem dialog...
  69.  
  70. echo Configuring Compaq Data+Fax Modem on \v(line)...
  71. output ATQ0V1\13        ; Enable word result codes
  72. chkok {Can't get modem's attention}
  73. output ATE1X4&C1&D2\13        ; Set echoing, result codes, etc.
  74. chkok {Can't initialize modem}
  75. output AT \\Q3\13        ; RTS/CTS hardware flow control
  76. chkok {Can't enable RTS/CTS}    ; On modem
  77. wait 5 cts
  78. if fail errfail {Configuration failed - no CTS from modem}
  79. set flow rts/cts        ; And in Kermit too, but only now
  80. output AT \\N3\13        ; Compression and EC enabled
  81. Chkok {Can't enable compression and EC}
  82. mpause 500
  83. clear input            ; Clear INPUT buffer.
  84. clear device            ; Clear device buffer.
  85.  
  86. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  87. echo
  88.  
  89. for \%i 1 \m(DIALRETRIES) 1 {    ; Redial loop
  90.     xif > \%i 1 {
  91.         echo Redialing...       ; Message for redialing
  92.         hangup            ; Hang up first
  93.     }
  94.     pause 1            ; Wait a sec for modem to settle
  95.     output ATD\m(__dm)\%1\13    ; Dial the number.
  96.     minput \m(DIALTIMEOUT) -
  97.       CONNECT BUSY ERROR {NO CARRIER} {NO ANSWER} {NO DIALTONE} RING
  98.     xif fail { echo Call timed out, hangup, out \13, continue }
  99.     switch \v(minput) {
  100.       :1, forward done
  101.       :2, Echo Line is busy - will dial again in 30 seconds.
  102.           echo Press any key to cancel...
  103.           output \13
  104.           pause 30
  105.           if fail errfail Canceled
  106.           break
  107.       :3, errfail {Dialing command error}
  108.       :4, errfail {Call failed - no carrier}
  109.       :5, errfail {No answer - try again later}
  110.       :6, errfail {No dialtone - is your modem connected to the phone line?}
  111.       :7, errfail {Call failed - your phone is ringing}
  112.       :default, break
  113.     }    
  114. }
  115. errfail {It never answers!  I give up.} ; Too many tries.
  116.  
  117. :DONE                           ; Connected.
  118. echo \7                         ; Celebrate with a beep.
  119. set carrier on            ; Require carrier from now on.
  120. set parity \m(__parity)        ; Restore host parity setting
  121. undef errfail            ; Erase local macro definitions...
  122. end 0                ; Finished, return success code.
  123.  
  124. :FAIL
  125. undef errfail            ; Erase local macro definitions...
  126. set carrier off            ; Let them reconnect to see what's up.
  127. hangup
  128. end 1                ; Return failure code.
  129.  
  130. ; End of COMPAQ.SCR
  131.