home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ckscripts / alphapage6 < prev    next >
Text File  |  2020-01-01  |  4KB  |  105 lines

  1. ; File ALHAPAGE
  2. ;
  3. ; Authors: F. da Cruz and C. Gianone, Columbia University, September 1996.
  4. ;
  5. ; For use with C-Kermit 6.0.192 or later.
  6. ; For a detailed explanation, consult "Using C-Kermit", 2nd Ed., pp.454-456.
  7. ;
  8. ; Revised July 1997:
  9. ;  1. To make TAPMSG fit into 1K for small C-Kermit versions.
  10. ;  2. Change END to STOP within SWITCH to work around bug
  11. ;     (these should be changed back to END in C-Kermit 6.0.193).
  12. ;
  13. ; TAPMSG, defined below, is an alphanumeric pager dialing script that
  14. ; implements the TAP protocol for sending one-line alphanumeric pages.
  15. ; To use the script, save it into a file, then tell C-Kermit to "take"
  16. ; the file.  Now you have the TAPMSG macro defined.  It assumes you have
  17. ; already made the phone connection.  Then invoke it with two arguments:
  18. ; the pager ID and the message.
  19. ;
  20. ; Of course, it is also easy to define a macro for making the connection and
  21. ; then sending the page, for example (just a sample, change as required):
  22.  
  23. define APAGE {
  24.     set modem type usr         ; I have a USR modem
  25.     set port com1              ; on COM1
  26.     set speed 1200             ; Must use 2400 bps for paging
  27.     set parity even            ; and even parity
  28.     set flow xon/xoff          ; and Xon/Xoff flow control
  29.     set modem flow none        ; end-to-end, not local
  30.     set dial retries 10        ; Allow 10 redials
  31.     dial 5554321               ; Call the pager service
  32.     if success -               ; If the call is answered
  33.       tapmsg \%1 {\%2}         ; Send the page
  34.     else end 1 Page failed.    ; otherwise fail
  35. }
  36.  
  37. ; To invoke the APAGE macro, put it in a file, edit it as necessary for your
  38. ; setup, tell C-Kermit to "take" the file, and then just type:
  39. ;
  40. ;   apage number { this is a message }
  41. ;
  42. ; at the C-Kermit> prompt, for example:
  43. ;
  44. ;   apage 99997654321 { Please call the office }
  45. ;
  46. ; Note: the pager ID number should not contain any spaces or else you must
  47. ; enclose it in braces:
  48. ;
  49. ;   apage { 999 76 543 21 } { this is a message }
  50. ;
  51. ; Ditto for the message.
  52.  
  53. COMMENT - TAPMSG - Send a one-line alpha page using TAP
  54. ;   \%1 = Pager ID
  55. ;   \%2 = Message
  56. ;
  57. def TAPMSG {
  58.   loc \%i \%m \%s blk        ; Local variables
  59.   asg \%m \2\%1\13\%2\13\3   ; <STX>ID<CR>msg<CR><ETX>
  60.   asg \%s \fchecks(\%m)      ; Get checksum and make block
  61.   asg blk \%m\fchar(\fmod(\%s/256,16)+48)-
  62. \fchar(\fmod(\%s/16,16)+48)-
  63. \fchar(\fmod(\%s,16)+48)\13  ; Checksummed TAP block
  64.  
  65.   for \%i 1 6 1 {            ; Try six times to get prompt
  66.     out \13                  ; Send <CR>
  67.     in 3 ID=                 ; Wait for "ID="
  68.     if succ break
  69.   }
  70.   if > \%i 6 end 1 No prompt
  71.   for \%i 1 8 1 {            ; Send <ESC>PG1, get <ACK>
  72.     msl 500
  73.     out \{27}PG1\13
  74.     min 3 {\6\13} {\21\13} {ID=} {\27\4\13}
  75.     switch \v(minput) {
  76.       :0, continue                ; Timeout
  77.       :1, break                   ; <ACK>
  78.       :2, continue                ; <NAK>
  79.       :3, out \{27}PG1\13, continue
  80.       :4, stop 1 Forced disconnect ; Fatal error
  81.     }
  82.     break
  83.   }
  84.   if > \%i 8 end 1 Timeout or bad response
  85.   in 5 \27[p\13                     ; Wait for go-ahead
  86.   if fail end 1 No go-ahead         ; Didn't get it
  87.   for \%i 1 8 1 {                   ; Try eight times
  88.     msl 500
  89.     out \m(blk)                     ; Send block
  90.     min 8 {\6\13} {\21\13} {\13\27\4\13} {\30\13}
  91.     switch \v(minput) {             ; Get response
  92.       :0, continue                  ; Timeout
  93.       :1, break                     ; <ACK> - success
  94.       :2, continue                  ; <NAK>
  95.       :3, stop 1 Forced disconnect
  96.       :4, echo ERROR - RETRYING, continue
  97.     }
  98.     out \4\13                       ; Sign off with <EOT>
  99.     in 5 \27\4\13                   ; Get <ESC><EOT> back
  100.     break                           ; But ignore timeout
  101.   }
  102.   if > \%i 8 end 1 Timeout or bad response
  103. }
  104. ; (End)
  105.