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

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