home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / scripts / ckermit / vmscapture.~1~ < prev    next >
Text File  |  2008-07-01  |  3KB  |  69 lines

  1. # CAPTURE macro for downloading text files from VMS without Kermit protocol.
  2. #
  3. # Installation:
  4. #   Copy this text into your K95CUSTOM.INI file.
  5. #   Tell K95 to "take \v(appdata)k95custom.ini" or restart K95.
  6. #   Alternatively, store this in a separate file and add a TAKE
  7. #   command for it to your K95CUSTOM.INI file.
  8.  
  9. # Usage:
  10. #   You must already have a connection to VMS and VMS must be at its
  11. #   command prompt.  If necessary, use Alt-X (or the second toolbar button)
  12. #   to go to K95's command screen.
  13. #   At the K-95> prompt, type "capture xxx", where xxx is the name of the
  14. #   file you want to download.  Alternatively you can type
  15. #   "capture xxx yyy" where yyy is the name you want to give the in Windows.
  16. #   If you don't give the second argument the file is stored with the
  17. #   same name.  The default timeout (maximum number of seconds for the
  18. #   capture to complete) is 120 seconds.  You can override the default by
  19. #   giving another number as the third argument.
  20. #
  21. # Bugs and limitations:
  22. #   1. The VMS command prompt appears at the end of the captured file.
  23. #   2. The capture can terminate prematurely if the VMS command prompt
  24. #      appears in the file itself.
  25. #   3. Since there is no error checking the captured file might have errors
  26. #      or gaps, especially on serial-port or modem connections.
  27. #   4. You can only capture text files this way.
  28. #   5. You can only capture one file at a time.
  29. # (That's why it's better to use a real file transfer protocol)
  30. #
  31. define hostprompt "$ "                  # VMS command prompt
  32. define capturetimeout 120               # Maximum time for capture (seconds)
  33. define typecommand "TYPE /NOPAGE"       # VMS command to display the file
  34.  
  35. define CAPTURE {
  36.     if not def \%1 {
  37.         echo "Usage:"
  38.         echo "CAPTURE vmsfilename [ localfilename [ timeout ] ]"
  39.     }
  40.     if not def \%2 assign \%2 \%1       # Local filename
  41.     if not def \%3 assign \%3 \m(capturetimeout) # Timeout
  42.  
  43.     if exist \%2 getok "OK to overwrite existing copy of \%2? "
  44.     if fail end 1    
  45.  
  46.     clear input                         # Clear INPUT buffer
  47.     output \13                          # Send a carriage return
  48.     input 5 "\m(hostprompt)"            # Wait to see prompt
  49.     if fail stop 1 CAPTURE: ERROR - FAILURE TO SEE DCL PROMPT "\m(hostprompt)"
  50.     
  51.     log session \%2                     # Open capture file
  52.     if fail end 1                       # Make sure it was opened.
  53.     output \m(typecommand) \%1\13       # Tell VMS to display the file.
  54.     input \m(capturetimeout) "\m(hostprompt)" # Wait for next DCL prompt
  55.     if fail {
  56.         echo "TIMEOUT \v(inwait) seconds - \%2 might be incomplete." 
  57.         echo "Check that the VMS prompt definition agrees with the"
  58.         echo "the actual VMS prompt.  Hint: you can specify a longer"
  59.         echo "timeout by changing the 'capturetimeout' definition or by"
  60.         echo "specifying the time limit as a third agument."
  61.         close session
  62.         end 1
  63.     }
  64.     close session                       # Close the capture file
  65.     echo "CAPTURE \%1 -> \%2 OK:"       # Give messages
  66.     directory \%2    
  67.     end 0
  68. }
  69.