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

  1. ; UPLOAD.SCR, discussed in Kermit News #6.
  2. ;
  3. ; A script for uploading text files from MS-Kermit to C-Kermit.
  4. ; Designed for use in conjunction with a Screen Reader.
  5. ; Alan Cantor - updated for MS-Kermit 3.14 - 2 December 1994
  6. ;
  7. define UPLOAD take upload.scr
  8. set key \3862 {\kUpload}      ; Shift-Ctrl-Alt-U
  9.  
  10. set mode-line off             ; For a less complex screen
  11. set input echo off            ; Detect INPUTs silently 
  12. set display serial            ; Quieter file transfers
  13. set terminal margin-bell on   ; Ding near right margin
  14.  
  15. ; MACROS
  16.  
  17. define file-name   c:\myfiles\message.txt ; Default file
  18. define cancel-key  output \3              ; Ctrl-C
  19. define break-key   output \26             ; Ctrl-Z
  20. define bell        echo \7                ; Ctrl-G
  21. define blankline   echo \13               ; Ctrl-M
  22.  
  23. define force-exit echo {Forced exit from Remote Kermit.},-
  24.  cancel-key, pause 1,-
  25.  cancel-key, pause 1,-
  26.  break-key, pause 1
  27.  
  28. define yes-no :LOOP,-
  29.  getc key {\%1 Y or N: },-
  30.  if equal \m(key) y \%2,-
  31.  if equal \m(key) n \%3,-
  32.  goto loop
  33.  
  34. :CHECK-CARRIER-DETECT
  35.  wait 0 \CD
  36.  if success forward VERIFY-NAME
  37.  stop 1 {No connection. Dial number first.}
  38.  
  39. :VERIFY-NAME
  40.  cls
  41.  yes-no {Send "\m(file-name)"?} {for FILE-EXISTS} {for GET-NAME}
  42.  
  43. :GET-NAME                                ; Prompt for file name
  44.  ask file-name {File to upload: }
  45.  if not defined file-name goto GET-NAME  ; If file-name = CR
  46.  
  47. ; File exists?
  48. :FILE-EXISTS
  49.  if exist \m(file-name) forward START-KERMIT
  50.  cls
  51.  bell
  52.  echo {"\m(file-name)" does not exist!}
  53.  blankline
  54.  echo {Perhaps it's in another subdirectory,}
  55.  echo {or on a different disk drive.}
  56.  blankline
  57.  goto GET-NAME
  58.  
  59. :START-KERMIT                             ; Start remote Kermit
  60.  cls
  61.  echo {Starting C-Kermit...}
  62.  blankline
  63.  output kermit -Y\13                      ; Use -Y switch
  64.  input 10 C-Kermit                        ; Look for C-Kermit prompt
  65.  if failure forward KERMIT-PROBLEM
  66.  output receive\13                        ; Begin upload, Step 1
  67.  pause 1
  68.  
  69. :SEND-FILE
  70.  if success echo {Starting upload...}
  71.  blankline
  72.  output \13                               ; Trick to speed start of transfer
  73.  send \m(file-name)                       ; Begin upload, Step 2
  74.  if failure forward KERMIT-PROBLEM
  75.  if success echo {"\m(file-name)" has been uploaded!}
  76.  
  77. :EXIT-KERMIT                              ; Exit remote Kermit
  78.  echo {Exiting Remote Kermit...}
  79.  pause 2
  80.  output quit\13                           ; "quit" C-Kermit             
  81.  input 5 >                                ; Look for Unix prompt
  82.  if failure force-exit
  83.  
  84. :CONNECT-NOW                             ; Issue CONNECT command
  85.  output \13
  86.  connect                                 ; Finally, begin terminal emulation!
  87.  STOP
  88.  
  89. ; Script Ends Here!
  90.  
  91. ; Problem scripts follow:
  92.  
  93. :LOGIN-PROBLEM                            ; Disconnect if prompt doesn't come
  94.  bell
  95.  echo {There appears to be a problem logging on.}
  96.  blankline
  97.  echo {Disconnecting. Try again!}
  98.  blankline
  99.  output \13
  100.  output logout\13                         ; Log off just in case
  101.  hangup
  102. END
  103.  
  104. :KERMIT-PROBLEM                           ; File transfer problem
  105.  force-exit
  106.  blankline
  107.  echo {Something unexpected happened during the file transfer.}
  108.  echo {The file "\m(file-name)" was not uploaded!}
  109.  blankline
  110.  echo {Possible reasons:}
  111.  blankline
  112.  echo {You pressed a key that stopped the file transfer,}
  113.  echo {your disk quota was exceeded,}
  114.  echo {the connection was broken, or perhaps}
  115.  echo {it's just another computer mystery!}
  116.  blankline
  117.  yes-no {Retry upload?} {goto START-KERMIT} {forward LOGOFF}
  118. END
  119.  
  120. :LOGOFF                                   ; Logoff
  121.  yes-no {Log off now?} {end} {stop}
  122.  blankline
  123.  force-exit
  124.  output logout\13
  125.  blankline
  126.  echo {Logged off.}
  127.  blankline
  128. END
  129.  
  130.