 ; SNAP3270.ASP for PROCOMM PLUS 2.01 (DOS).
 ; This is intended for performing screen snapshots of the Host screen
 ; any time a PF key, Enter, or Clear is pressed, _before_ the
 ; emulation of that key is transmitted. By using SNAPSHOT commands,
 ; the snapshot file should produce an acceptable disk file record
 ; of the session. It will not handle automatic referesshing of screens
 ; (e.g., where several screens are transmitted without user inter-
 ; vention, such as some mainframe status displays that automatically
 ; self-refresh).
 ;
 ; Usage: make the changes below if needed for additional keystrokes, 
 ;        then compile with ASPCOMP.
 ;        When you call your mainframe, you will have to start SNAP3270
 ;        (e.g., hit Alt-F5, then type in SNAP3270), and then each
 ;        screen will be saved to the file listed in PCSETUP, FILE/PATH
 ;        OPTIONS, B--Default filename for screen snaopshot files.
 ;
 ; Warning: if you use an editor to view the file, you may want to
 ;          rename the file afterwards because some editors write a
 ;          Ctrl-Z (CPM style of EOF) at the end of the file, and the
 ;          next snapshot (or the output from this script) would be
 ;          written _after_ that Ctrl-Z, making it invisible to your
 ;          editor. If you use PCEDIT, check setup (Alt-S), GENERAL
 ;          OPTIONS, D--Omit EOF mark and make sure it is YES.
 ;
 ; Legalities: this script was written by Mark A. Young as a labor of
 ;             love and this script is released into the Public Domain.
 ;             There are no implied warrantees about the suitability of
 ;             this script for your needs. Not responsible for data
 ;             loss.
 
 proc main
    integer c                   ; Will hold character.
    set keys on                 ; All keypresses go into the script.
    while forever               ; Do until we quit.
       if hitkey                ; Was a key pressed?
          keyget c              ; Yes. Get the keystroke.
          if c == 27            ; Was escape pressed? (Change if you
                                ; want another keystroke to exit scr.)
             set keys off
             exit
          endif
          switch c
             case 13       ; CR     (Hydra's Enter key)
             case  3       ; Ctrl-C (Hydra's Clearscreen)
             case 0x3B00   ; F1
             case 0x3C00   ; F2      Add additional keys here if
             case 0x3D00   ; F3      needed. The hex codes can be
             case 0x3E00   ; F4      found in PCPLUS, Alt-Z Alt-Z
             case 0x3F00   ; F5      (help, help), T (for topics),
             case 0x4000   ; F6      HOME (top of topic list),
             case 0x4100   ; F7      DownArrow (to get ASPECT Keycode
             case 0x4200   ; F8      Reference), Enter (to display the
             case 0x4300   ; F9      ASPECT Keycode reference), and you
             case 0x4400   ; F10     can then PageDown and PageUp
             case 0x8500   ; F11     through the list. Note that the
             case 0x8600   ; F12     code entered is the PC keyboard
             case 0x5400   ; Shift-F1  character, _not_ the emulation
             case 0x5500   ; Shift-F2  bytes transmitted (the TERMKEY
             case 0x5600   ; Shift-F3  command feeds the character to
             case 0x5700   ; Shift-F4  the keyboard mapping logic so
             case 0x5800   ; Shift-F5  that the appropiate sequence of
             case 0x5900   ; Shift-F6  bytes are transmitted).
             case 0x5A00   ; Shift-F7
             case 0x5B00   ; Shift-F8   This list should cover all PF
             case 0x5C00   ; Shift-F9   keys, Clear (3), and Enter (13),
             case 0x5D00   ; Shift-F10  but you should verify that
             case 0x8700   ; Shift-F11  those special keys are correct
             case 0x8800   ; Shift-F12  for _your_ mainframe's protcol
             case 0x5E00   ; Ctrl-F1    converter. You may also want
             case 0x5F00   ; Ctrl-F2    to add keypresses for the three
             case 0x6000   ; Ctrl-F3    PA keys if you discover the
             case 0x6100   ; Ctrl-F4    codes for them and map them to
             case 0x6200   ; Ctrl-F5    a key on the keyboard.
             case 0x6300   ; Ctrl-F6
             case 0x6400   ; Ctrl-F7
             case 0x6500   ; Ctrl-F8
             case 0x6600   ; Ctrl-F9
             case 0x6700   ; Ctrl-F10
             case 0x8900   ; Ctrl-F11
             case 0x8A00   ; Ctrl-F12
                snapshot     ; If any of above keys occur, do a SNAPSHOT
             endcase
          endswitch
          termkey c   ; In any case, tell PCPLUS to act like the
       endif          ; key was pressed.
    endwhile
 endproc
