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

  1. ; FILE HAYES.SCR
  2. ;
  3. ; To be used with MS-DOS Kermit 3.11 or later.
  4. ;
  5. ; An MS-DOS Kermit script program for dialing Hayes 2400 Smartmodems and
  6. ; compatibles.  Should also work with Hayes 1200, and ROLMphone 244PCs.
  7. ;
  8. ; Stored in Kermit Distribution as MSMHAYES.SCR; rename to HAYES.SCR if
  9. ; necessary so the DIAL macro can find it.  Place this file in your current
  10. ; directory, or any directory in your DOS PATH.
  11. ;
  12. ; Expects variable \%1 to contain the phone number; this is done by the DIAL
  13. ; macro defined in MSKERMIT.INI.  If you lack the DIAL macro definition, use
  14. ; this simple substitute:
  15. ;   DEFINE DIAL TAKE HAYES.SCR
  16. ; To use, just type DIAL nnnnnnn at the MS-Kermit> prompt, where nnnnnnn is
  17. ; the desired phone number.
  18. ;
  19. ; Uses ATD (modem's default dialing method) to dial the number.  Force tone
  20. ; dialing by including T as first character of phone number, or pulse dialing
  21. ; by including P as first character.
  22. ;
  23. ; Sets SUCCESS flag if dialing succeeds, sets FAILURE flag if it fails, for
  24. ; use with IF SUCCESS, IF FAILURE, \v(status).
  25. ;
  26. ; Puts the Hayes modem in the following modes, which this script depends upon
  27. ; for proper operation:
  28. ;   Q0 = Enable result codes
  29. ;   V1 = Use verbose (English) result codes
  30. ;   X1 = Enable result codes OK, CONNECT, RING, NO CARRIER, ERROR,
  31. ;        CONNECT 1200, CONNECT 2400
  32. ; These are set by the statement:
  33. ;   output ATQ0V1X1\13
  34. ; If these modes don't agree with your modem's normal settings, you can add
  35. ; OUTPUT commands to restore the desired settings just before the two END
  36. ; statements at the end of this file.
  37. ;
  38. ; Hayes modems do not issue any messages like RINGING or RRING when the other
  39. ; phone is ringing, but certain Hayes-compatible modems do, like Telebit.  If
  40. ; you experience problems with this, comment (or uncomment) the appropriate
  41. ; statement below, in the "GOTMSG" section below.  (Note: RING is different:
  42. ; it means another modem is calling your modem.)
  43. ;
  44. ; Author: Christine M. Gianone, January 1990
  45. ; Updated for MS-DOS Kermit version 3.11, July 1991
  46. ; Updated to allow redial cancellation from keyboard, July 1993
  47. def errfail echo \%1,hangup,goto fail ; Macro to handle failures.
  48.  
  49. if < VERSION 311 errfail {MS-DOS Kermit 3.11 or later required.}
  50. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE
  51. set input echo off              ; Don't echo the modem test
  52. output ATQ0V1X1\13              ; Send AT, use word result codes.
  53. input 2 OK                      ; Modem should say "OK"
  54. if fail errfail {Turn on or connect your modem!}
  55. clear                ; Clear input buffer
  56. if def \%1 if equal "\%1" "=" end 0 ; Phone number "=" means initialize only.
  57.  
  58. set count 5                     ; Set up dialing retry counter
  59. set input echo on               ; From now on, show what happens
  60. echo Dialing \%1, wait...
  61. pause 1
  62. goto dial                       ; 1st time, skip Redialing message
  63.  
  64. :REDIAL
  65. set alarm 30
  66. pause 30            ; Wait 30 seconds before redialing.
  67. if not alarm errfail {Dialing canceled.}
  68. echo Redialing...               ; Message for redialing.
  69. pause 1
  70.  
  71. :DIAL
  72. output ATD\%1\13                ; Dial the number (ATDT or ATDP)
  73. ;;;pause 20            ; *** Might be necessary for some modems.
  74. set alarm 60            ; Detect keyboard interruptions.
  75. clear                ; Clear INPUT buffer.
  76. input 40 \10                    ; Wait for the linefeeds...
  77.  
  78. :GETMSG
  79. input 20 \10            ; that surround response message.
  80. if success goto gotmsg        ; Got a message.
  81. if alarm errfail {No response from modem.} ; No response in 60 secs.
  82. hangup                ; User interrupted from keyboard,
  83. goto again            ; so try again right away
  84.  
  85. ; REINPUT 2 needed for GVC and maybe other modems that put out
  86. ; extra linefeeds.
  87.  
  88. :GOTMSG
  89. reinput 2 CONNECT               ; Got message, was it CONNECT?
  90. if success goto speed           ; Yes, go check the speed.
  91. reinput 2 ERROR            ; No, check for command error.
  92. if success errfail {Modem command error.}
  93. reinput 2 NO CARRIER        ; NO CARRIER?
  94. if success goto busy        ; Treat like BUSY.
  95. reinput 2 BUSY                  ; BUSY?
  96. if success goto busy         ; Go wait a bit, then dial again.
  97. ; reinput 2 RRING        ; *** No, check for RRING (Telebit only).
  98. ; if success goto getmsg    ; *** RRING, just wait for next message.
  99. ; reinput 2 RINGING        ; *** No, check for RINGING (not real Hayes).
  100. ; if success goto getmsg    ; *** RINGING, just wait for next message.
  101. errfail {No dialtone or no answer.  Try again later.}
  102.  
  103. :BUSY
  104. if < \v(count) 2 goto quit    ; Don't wait 60 seconds if tries used up.
  105. Echo Busy or No Carrier, will dial again in 30 seconds...
  106. echo Press any key to cancel...
  107. hangup                          ; Hang up.
  108. :AGAIN
  109. if count goto redial            ; Then go redial.
  110. :QUIT
  111. errfail {It never answers!  I give up.} ; Too many tries.
  112.  
  113. :SPEED                          ; Connected!
  114. echo \7                         ; Celebrate with a beep.
  115. reinput 0 1200                  ; Was the message CONNECT 1200?
  116. if success set speed 1200       ; Yes, change the speed.
  117. reinput 0 2400            ; Was it CONNECT 2400?
  118. if success set speed 2400    ; Yes, change speed.
  119. define errfail            ; Erase ERRFAIL definition
  120. end 0                ; Finished, return success code.
  121.  
  122. :FAIL                ; Dialing failed.
  123. define errfail            ; Erase ERRFAIL definition
  124. end 1                ; Return failure code.
  125.