<<<<<<<<<<<<<<<<< HOOK  Hot-Key Router & Macro Facility >>>>>>>>>>>>>>>>>>

Contents of HOOK301.ZIP

 FileName      Description of File
 DOSERDLL.DLL  Dynamic Load MOdule - For DOS API Error Messages
 HOOKQDLL.DLL  Dynamic Load Module - intercepts system message queue
 HOOK.DAT      Sample Optional data file for hot-key assignments - read by HOOK.EXE
 HOOK.EXE      Executable File - Executes According to Key Combinations Struck
 HOOK.INI      Binary file read by HOOK; has configuration data for HOOK.
 HOOK.INF      INF file displayed by VIEW.EXE - has Help/Information for HOOK
 HOOK.HKY      Binary File Maintained by HOOK - Has Hot Key Assignments 
 HOOK.TXT      ASCII File with instructions on installing and using HOOK
 INSTALL.EXE   Complete Install of HOOK including target drive and directory.
 OBJOPEN.EXE   Program that opens Folders from Command Line
 OBJOPEN.DOC   Document File for OBJOPEN.EXE
 PLAYBACK.EXE  PlaysBack Hook created Macros from Command Line
 PLAYBACK.DOC  Document File for PLAYBACK.EXE
 PLAYKEYS.EXE  PlaysBack Hook created KB Macros from Command line
 PLAYKEYS.DOC  Document File for PLAYKEYS.DOC

 The INSTALL program copies the 6 files hook.* listed above to the Directory 
 and Drive specified by you at Install Time. The two DLL files are copied to 
 \os2\dll on the drive that OS/2 is installed on. The INSTALL program 
 determines that drive.

 The 6 files listed below it are 3 special programs and their
 documentation files. These carry out specific tasks.  You should
 install them in a directory of your choice (which could of course be
 the directory you install HOOK into).

 Install.EXE places the 6 files named HOOK into X:\HOOKDir\ where X: is the 
 drive ID entered into the Install Window and HOOKdir is the directory name 
 entered (HOOK is default). DOSERDLL and HOOKQDLL are installed in \OS2\DLL on 
 the drive holding the OS2 system files (usually C:)

 Since the DLL files are installed in the \OS2\DLL directory there is no need 
 to modify CONFIG SYS since the LIBPATH already contains \OS2\DLL and thus no 
 need to REBOOT in order to start the program.

  WHAT THE HOOK DOES

HOOK was designed to alleviate the need to clear up the Desktop of OS/2 in 
order to obtain access to Icons to load programs and to facilitate switching 
from one active program to another.

I found myself all too frequently having to to minimize some of my active 
programs in order to access the Desktop to load another program that was 
required. Additionally I wanted a quicker way of switching to another 
program than using Alt-Esc to move through active programs until I came to 
the desired one or by accessing the Task List to select the program or my 
using the Mouse to activate an Icon.

Conceptually then, HOOK is akin to a DOS TSR. Whereas a DOS TSR is resident 
in Memory, HOOK works through DLLs, DOSERDLL and HOOKQDLL.DLL are loaded 
into memory when HOOK is loaded. 

DOSERDLL contains information for display if an Error occurs using an OS/2
DOS function.

HOOKQDLL monitors the message queue for WM_CHAR messages, the equivalent of 
a TSR hooking the KB interrupt. WM_CHAR messages contain information on 
Keyboard activity and HOOKQDLL, depending on the Keyboard Activity sends 
messages to HOOK which executes according to the key combinations struck as 
defined in the file HOOK.HKY (new feature) which is maintained by HOOK.EXE.

OS/2 itself by default assigns a variety of actions to Keystrokes. For
instance F1 brings up HELP, Alt-F4 closes an active program, Ctrl-Esc brings 
up the Task List,Alt-Esc and Tab-Esc switch to the next program in the Task 
List, Alt-F7  moves a Window, Alt-F8 resizes, Alt-F10 maximizes, Alt-F5 
restores and so on. In addition each program as a rule has its own set of 
dedicated Keystrokes to accomplish certain actions. Editors and Word 
Processors are very rich in such keystroke assignments.

If a Hot-Key type program is to be useful, it should be as unobtrusive as 
possible and not interfere with programmatic hot-keys. I originally chose 
the triple key combination of Shift-Alt-X, Shift-Ctrl-X, where X ]can be 
0,....9,A,B,.....Y,Z (case insensitive) for the Hot-Keys since in my 
experience to date, they had been almost unused. I also used those
combinations with X being keys on the Key_Pads for Hard Coded actions 
relating to tasks involving HOOK itself. A configuration option exists that 
allows these hard coded assignments to be active only on the Numeric Key 
Pad. I have recently added the combination Alt-Ctrl-X to the Hot Keys 
increasing the capability by 50 %. 

Now for some CAVEATS.

There are some editors, the E.EXE OS/2 Editor for instance as well as the 
Editors built into many Compiler programs that use the Shift-Ctrl-Cursor_Pad 
keys very heavily for Block activities and thus I have added a Toggle key to 
HOOK that allows the user to temporarily toggle its trapping actions OFF so 
that the total Keyboard is available to the user. That same Toggle key then 
re-activates HOOK so that Hot-Key switching is back ON.

PM programs also make use of Mnemonic Keys when the Menu bar is active
(menus accessible with Alt-F, Alt-H, etc.). If a PM program uses mnemonic
keys ( Help is an example) and you have H assigned as a HOT-Key, say
Shift-Alt-H. Then when you press Shift-Alt-H you will get the Menu Key 
Option for H, but pressing it a second time will bring up the Hot-Key 
assignment.

In addition PM programs may also use assignments to Ctrl-X (as the E edior 
does for X=F for the Find option). If you have a Hot-Key assigned to 
Shift-Ctrl-X, where X is a program defined key, then the Hot-Key will bring 
up that option. A quick repeat of the Hot-Key will produce its desired 
action.

These kinds of problems do not bother non-PM programs (ASCII text editors) 
and similar TEXT based Non-PM programs.

I have built into HOOK a configuraton option (changeable while HOOK is in 
use) that can modify the above behavior. HOOK works through HOOKQDLL.DLL 
which intercepts the message queue and looks at each WM_CHAR message. Each 
message has a flag that indicates whether it is a PM type application or not 
and the DLL tests that flag. The configuraiton option allows the DLL to take 
an action depending on whether that flag is set for a given WM_CHAR message.

The default option is to ignore the flag. This has the consequence that the 
program entering key strokes and thus using Hot-Keys has the KB focus and 
will activate any PM program user defined keys - as noted this can be 
quickly overridden by entering the Hot-Key again. But one can change that 
behavior with the DLL configuration option so that when a PM program has the 
KB focus, when a Hot-Key sequence is hit, it switches the focus to the 
DeskTop so that the PM program's defined keys are not accessed. Whether this 
is desireable or not depends on the particular PM program, how one uses it 
and so forth. In general I find the default setting of no resetting the 
focus the most useful, since  re-entering the hot-key if required is not 
very onerous and you do not lose access to a programs built in keystrokes.

End of CAVEATS

There are two classes of hot-key assignments in HOOK. One class is hard
coded and cannot be changed by the user. 

The other is under the user's control and allows the user to assign specific 
actions to a given key combination. That assignment may be done in one of 
two ways. The default (new) is by filling in parameters into a menu 
activated by Shift-Alt-F3. An optional method is to fill in a (user 
maintained) ASCII Text file (HOOK.DAT) which HOOK can read in on command 
activated by Shift-Alt-UpArrow when HOOK is active.

These two methods are not exclusive and both may be used. The HOOK.DAT file 
is backwardly compatible with earlier versions of HOOK. The Hot Keys assigned
by filling in the parameters into the Menu are saved in the file named
HOOK.HKY which is re-read every time HOOK is loaded. Any assignments read in
from HOOK.DAT are saved in the same structure saved by HOOK.HKY and are thus 
not lost when HOOK is exited.

HOOK has an additional feature. It can (with some limitations) save a
sequence of Keyboard and Mouse Actions so that they may be replayed. I have 
found this useful for establishing certain DESKTOP environments that I use 
repeatedly. These "Macros" may be saved to Disk and restored From disk to 
memory for replay. When saved to disk, the user is prompted for the name 
under which to save the macro and two files are saved in X:.\HOOKdir. One 
with the extension HEX which is the file that can be played back when loaded 
into memory and the other a Text file with extension MAC. The latter 
contains the information in the Message queue for the sequence of commands 
that are in the Macro.

These macros may also be played back from the command line (or assigned to 
Hot Keys to play them back) by using PLAYBACK.EXE for general macros and 
PLAYKEYS.EXE for those macros  containing only KB strokes. In that case the 
DLL setting should correspond to the Active Window having the KB focus, 
otherwise your playback does not go where you intend it to.

HOOK communicates with the user via a small window on the desktop. I have 
found it useful to have this window contain the current date and time as 
well as to display messages from the program. The window appears as:

                  Ŀ
                   KB  hh:mm:ss 
                   Day  mm-dd-yy 
                  

The time is updated every second and the updates are maintained via a 
separate thread started from HOOK .

There is an option in the On Line configuration to make the Window Invisible 
as well as options to change its size, location and colors (if Visible).The 
default location is the lower right corner.

Messages are displayed on the first line of the display temporarily
overwriting the current time.

INSTALLING THE HOOK

To use the Install.exe program, be sure it is in the same directory as the 
rest of the files included in the ZIP file. If you are installing from a 
floppy, make the floppy drive the active directory and be sure that OS/2 is 
active. You should do this from an OS/2 window.

IF a PREVIOUS VERSION IS ACTIVE, UNLOAD it before installing this version.

INSTALL.EXE installs this version in a directory named \HOOKdir on a drive 
(X:) both modifiable by the user in a Menu Entry Field. The Install program 
verifies the validity of the Drive selected and the length of the name 
entered for the directory (no longer than 8 characters).

To use INSTALL just enter INSTALL from the command line where the current 
directory contains INSTALL,EXE and the other unzipped files.

The files will be copied to the appropriate directory and if it does not
exist it will be created.

What INSTALL.EXE does in detail:

A menu is presented with an input field of

  C:\hook

prompting the user to accept the parameters as given or to edit them to meet 
his/her requirements. Both the drive letter and the length of the directory 
name are validated (directory name length <= 8 chars.).

IF X:\HOOK\ (or the drive:\name chosen) does not exist, it will be created.

If HOOK.DAT exists in X:\HOOK\ it will be renamed to HOOK.OLD. HOOK.DAT,
HOOK.EXE, HOOK.HKY, HOOK.INF, HOOK.INI, HOOK.TXT will be copied to X:\HOOK\. 
DOSERDLL.Dll and HOOKQDLL.DLL will be copied to \OS2\DLL on the drive where 
that directory exists.

             !!!    FOR USERS OF PREVIOUS VERSIONS   !!!

You should delete any current version of HOOKQDLL.DLL before beginning the
installation of this version.

This new version is backward compatible with HOOK.DAT BUT its primary,
and the DEFAULT method of entering HOT Key Assignments is by the use of
an ON SCREEN menu system, activated by Alt-Shift-F3. If you prefer to
use the former method of assigning Hot Keys (i.e. via HOOK.DAT) its
assignments must now be manually read in after HOOK is loaded by using
the Hot-Key Shift-Ctl-UpArrow (changed from  prevous versions) or making
a selection from the Menu (activated by Alt-Shift-F2).

After completing the installation you may substitute your current
HOOK???.DAT file by copying it to X:\HOOKdir and renaming it as HOOK.DAT. 
BUT before doing that look at the header to the default DAT file which 
comments its structure for calling programs. Current DAT files can be used 
but there are enhancements that you may find useful. It would probably be 
wiser to just edit HOOK.DAT to reflect your current usage.

CONFIGURING THE HOOK

There are various configuration parameters for the program which are stored 
in the file HOOK.INI which is read in by the program when it is started and 
which remain in effect unless changed from the configuration menu. In 
addition HOOK.HKY which has the User Defined Hot-Key Assignments is also 
read in when the program is started .

User Assignments may be modified when the program is active as may the other 
configuration options. 

Hot-Key Assignments are modified by using Shift-Alt-F3 to access the Hot-Keys 
Menu Screen to add new assignments, delete current assignments or overwrite 
current assignments. Hot-Key Assignments may also be modified by altering 
HOOK.DAT and then re-reading it into memory using Shift-Ctl-UpArrow.

The program window may be resized and relocated by using the Mouse Pointer 
at the window edges to change window dimensions, thus effectively resizing 
and relocating the window. The ability to save those changes for the next 
startup are among the configuration options for the program.

These options for the program are available by placing the mouse pointer
anywhere on the display window and pressing the right mouse button or by
pressing the key combination Shift-Ctrl-5 or Shift-Alt-F2.  Either
brings up the menu displayed below:

   Quit KeyBoard Hook
   Select Editor to use for DAT File Edit
   Edit HOOK.DAT File (Updates HOOK when Edit HOOK.DAT exited)
     (To UPDATE while Editing : Save File then Shift-Ctl-UpArrow )
   Assign Hot Keys
   Read In HOOK.DAT assignments for Hot Keys
   Save Current Hot Key Assignments to HOOK.HKY
   Get HOOK.HKY Assignments for Hot Keys
   Change Colors
   Window Options
   Message Display and KeyPad Use Options
   DLL Option Set Window Focus for PM Programs

   Explanations:

   Quit KeyBoard Hook
        Closes the program in an orderly fashion.

   Select Editor to use for DAT File Edit
        Allows user to enter the filespec of the editor to use for
        editing the DAT file or to change the filespec of the default
        editor (E.EXE) if it is not in X:\os2\. The editor
        selected is saved in HOOK.INI.

   Edit HOOK DAT File
        By default uses the E.EXE editor of OS/2. It is assumed that editor
        is located in C:\os2. The filesper may be changed using
        the option listed above.

   (Updating the EXE file occurs when the Editor Above is Closed)
        The DAT file is automatically re-read into the EXE file and
        the appropriate buffers updated when the Editor used to modify
        the DAT file is closed. If one does not use this option to
        modify the DAT file, then the EXE may also be dynamically
        updated with the Key combination Shift-Alt-UpArrow.

   Assign Hot Keys
        Activates the Define Hot-Keys Menu (same as Shift-Alt-F3)

   Read In HOOK.DAT assignments for Hot Keys
        Same as using Shift-Ctl-UpArrow to read in current HOOK.DAT File

   Save Current Hot Key Assignments to HOOK.HKY
	Saves all Current Hot-Key Assignments to disk in HOOK.HKY

   Get HOOK.HKY Assignments for Hot Keys
        Reads in HOOK.HKY from Disk. This will override all current assignments
        in place. This is same as Shift-Alt-UpArrow.

   Change Colors
        Presents the user with a menu allowing the selection of Foreground
        and Background Colors from a group of 16 options Using Push Buttons.
        The changes are effected immediately and are saved in HOOK.INI.

        F WHITE  B       F DARKGRAY  B
        F BLACK  B       F DARKBLUE  B
        F BLUE   B       F DARKRED   B
        F RED    B       F DARKPINK  B
        F PINK   B       F DARKGREEN B
        F GREEN  B       F DARKCYAN  B
        F CYAN   B       F BROWN     B
        F YELLOW B       F PALEGRAY  B

        Default Foreground = Blue   Default Background = White

        In the Menu the Actual Colors are displayed instead of the Text
        indicating the colors.


   Window Options
   Selecting the Window Options presents 6 check boxes allowing a selection
   of Window Placement/Size Options from
     [ ] Win-Left
     [ ] Win-Center
     [] Win-Right                           Default
     [ ] Use Current Win Size/Position

     [] Window Visibile                     Default = ON
     [] Window Not Jumpable                 Default = Not Jumpable

    The four choices grouped together in the Win positions are mutually
    exclusive. Only one them may be chosen. The first three select a
    small window
                  Ŀ
                   KB  hh:mm:ss 
                   Day  mm-dd-yy 
                  

    positioned at the bottom of the screen as indicated.

    The fourth choice is meant to be used if none of the first three are 
    acceptable. The user may reposition and resize the window by using the 
    pointer to drag the sides to new locations and to resize the window 
    accordingly. After it is positioned to your liking that selection will copy 
    the data for the new window position to HOOK.INI and it will be used on 
    starting up again.

  Message Display and KeyPad Use Options
    Hook may be unloaded (Shift-Alt-Del) or unloaded and OS/2 Closed
    down (Shift-Alt-End). The DEFAULT is to display a Message Box for
    either case asking if you want to continue. This may be changed
    to no Message Box display with this option.

    Some computers have 2 Sets of Key Pads . One has numeric keys and is
    referred to as the W(hite) pad and the other  has cursor keys and is
    referred to as the G(rey) Pad. The DEFAULT configuration is to have
    both key pads respond to the Built In Hot-Key Assignments which use
    the Key Pad in conjunction with the Shift-Alt/Ctrl keys. That may be
    changed to use only the Numeric Key pad with this option.

  DLL Option Set Window Focus for PM Programs
    The DEFAULT configuration does not change the KB Focus of the
    program entering Hot-Keys. This means that if a PM program has
    defined Alt-X or Ctrl-X combinations and you enter a Hot-Key
    combination that has Alt-X or Ctrl-X in it, it will activate that
    built in option; repeating the Hot-Key will then activate its
    desired action, closing the program defined action. Retaining this
    setting also means that Keyboard Macros will be entered into the
    current window as it has the KB focus.

    The other option changes the KB focus from the window that had the
    focus to the DeskTop. This means that no  repeat Hot-Keys need
    be entered, but also playback of KB macros does not work, nor does
    the user have access to the programs defined option keys.

    In general the DEFAULT option of Window retaining the KB focus is
    the most useful and flexible.

    Changes made from this Menu remain in effect thru the remainder of
    the session while HOOK is active. When the session is ended, via
    Shift-Alt-End or Shift-Alt-Del the current values of these parameters
    are saved in HOOK.INI and these are restored for use when the program
    is next loaded.

SELECTING THE EDITOR FOR EDITING THE DAT FILE

As noted the default editor used for editing the DAT file is the E.EXE
editor that is included with OS/2. The assumption is made that this is
located in C:\os2 where it is placed when installing OS/2 2.0 or 2.1 or
WARP. If this editor is not satisfactory you should choose one that is.


HOT-KEY ASSIGNMENTS-FIXED BY PROGRAM

The fixed key assignments are all related to the functioning of HOOK and
with one exception use the Shift-Alt or Shift-Ctrl keys in combination
with the Numeric or cursor pad (default option).

HARD CODED ASSIGNMENTS     Explanations

Shft-Alt-?              Display User Defined HotKeys for Shift-Alt-X **
Shft-Ctl-?              Display User Defined HotKeys for Shift-Ctl-X **
Alt-Ctl-?               Display User Defined HotKeys for Alt-Ctl-X   **
Shft-Alt-\              Display Prog Defined HotKeys (this listing)

Shft-Alt-Del            Unload HOOK
Shft-Alt-End            Unload HOOK and ShutDown System

Shft-Alt-UpArrow        Read HOOK.HKY into Memory
Shft-Alt-DnArrow        Save Current Hot Keys to HOOK.HKY
Shft-Ctl-UpArrow        Reac HOOK.DAT into Memory
Shft-Alt-Ins            Open Small OS/2 Window

Shft-Ctl-LeftArrow      Start Macro Recording
Shft-Ctl-[              Start Macro Recording *
Shft-Ctl-RghtArrow      End Macro Recording and Save to Disk File
Shft-Ctl-]              End Macro Recording and Save to Disk File *
Shft-Ctl-Ins            PlayBack Macro Currently in Memory
Shft-Ctl-PgDn           Save Current Loaded Macro to DiskFile
Shft-Ctl-PgUp           Load Selected Macro from Disk to Memory

Shft-Alt-5              Toggle Hot-Keys Off/On
Shft-ALt-F2             Activate PopUpMenu for Configuration Options
Shft-Ctl-5              Activate PopUpMenu for Configuration Options
Shft-Alt-F1             Activate On LIne Reference Window

Press Right Mouse Button   Activate PopUpMenu for Configuration Options
When Pointer Over Window

* These options exist for use when recording macros in the E and EPM editors
  and similar ones which use Shift-Left|Right Cursor to Start and End copy
  and paste operations of text.

**This display reflects the current Active Hot-Key assignments. If HOOK.DAT 
  is read in with new assignments or new assignments are made from the Hot-Key 
  Menu those are automatically reflected in this listing. No user intervention 
  is required for these file displays (this is  changed from earlier versions 
  which required the user to create these displays)

HOT-KEY ASSIGNMENTS-USER DEFINED

There are two methods that may be used to assign Hot-Keys. The first is
NEW, and employs an On Screen Menu titled   

                         Define Hot-Keys

This menu is activated by the Hot-Key Alt-Shift-F3 or by selecting the 
Assign Hot Keys choice from the User Menum Activated by Shift-Alt-F2. 

The other method is backward compatible with that used in earlier versions
of HOOK. It involves filling in an entry in the text File HOOK.DAT that 
defines the Hot Key Assignment. This file is read into HOOK by using the 
Hot-Key Shift-Alt-UpArrow (in earlier versions this was automatically read 
into HOOK when it was loaded).

The Hot-Key assignments that are in place when HOOK is exited are 
automatically saved in the file HOOK.HKY and these are automatically read 
into HOOK when it is loaded. (There are options in the menu activated by 
Alt-Shift-F2 to save the current Hot-Keys to HOOK.HKY and to re-read 
HOOK.HKY into memory.)

The active Hot-Key assignments are in a Record Format in HOOK.EXE, where 
there is a separate record for each of the possible Hot-Key Assignments. When 
HOOK.DAT is read into HOOK it fills out only those records for which a 
Hot-Key is assigned in HOOK.DAT. If an assignment exists it is over written.

If HOOK.HKY is read into memory it completely overwrites the current records
so that they are lost. If you want to maintain different sets of Hot-Key
assignments then a given set should be Read Out to HOOK.HKY and that saved by
renaming it. To read it back it would then have to be renamed back to
HOOK.HKY. Alterately you could save different sets in a series of HOOK.DAT
files (stored in a different directory) and copy the one you want to be 
active to the directory where HOOK.EXE is stored.

                   THE DEFINE HOT-KEYS MENU SCREEN
	  ( O is a radio button  [    ] an Entry Field   [[  ]] a Push Button )

  -------- Hot Key type ----------    --- ID for Selected Type ----
  o Shft-Alt  o Shft-Ctl  o Alt-Ctl    ID(Digit/Char):[ ] CR Accepts

 Program File Spec:[                                          ] CR Accepts

 o Shell Establish Sess   o Full Screen OS/2 Sess   o Windowable(Vio) Sess
 o Windowed  (PM)  Sess	 o Full Screen DOS  Sess   o Windowed DOS  Sess

      	          !! The Four Items Below are Optional !!
      Command Line:[					      ] CR Accepts
 Working directory:[					      ]	CR Accepts
       Description:[					      ]	CR Accepts
 Woindow Locn/Size:[	             ] As: xxx yyy wwww hhhh  ] CR Accepts
      (in Pels)

                     [[SAVE This Hot Key Assignment]]

   [[CLEAR The Selected Hot Key]]		 [[CLEAR All Hot Keys]]

	  Cursor UP/Dn/Left/Right Keys Moves Within Groups
              SpaceBar or Left Mouse Button to Select
                      Tab Key to Next Group
   		      Press <Esc> to Abort

The user Fills in the Hot Key Menu to assign a program to a Hot Key.

The user MUST : Select a Hot Key type ; Enter a Hot Key ID in the Entry Field ;
                Enter the program specification (just as in the Path Field in
                the Settings Menu; Select ONE of the Session Types (letting the
                Shell establish the type is a good safe choice). 

There are FOUR Optional Items that may be entered:

      Command Line: Parameters that need to be passed on the program command line.

 Working directory: The default directory from which the program is loaded. Many
                    programs look for their initialization files in the default
                    directory.

       Description: This is merely a description for Info Purposes. It may be
                    displayed on the Task List

  Window Locn/Size: If the program is windowed you may specify its Location and
                    its Initial Size (both in Pels). xxx is the X location and
                    yyy the Y location of the Lower Left Corner of the Window
                    referenced with respect to 0,0 as the lower left corner of
                    the Screen. wwww is the window width and hhhh its height.

Pushing the [[SAVE This Hot Key Assignment]] Push Button saves this entry
and enters it into a Record in the Hot Key data structure.

The two Push buttons with CLEAR in them do as indicated. Be very careful
using the [[CLEAR All Hot Keys]] for that will leave you with no Hot Keys
active; if you push this by accident you can read back in your latest
HOOK.HKY from the Menu activates by Alt-Shift-F2.

USER DEFINED DATA FORMAT In HOOK.DAT   

The user defined hot-key assignments are made in the text file HOOK.DAT 
which is in the directory X:\HOOK\ . The default file loaded by INSTALL has 
a series of comments in it that describe the format of making key 
assignments and there are a number of assignments made in that file as 
examples. The user can delete them, reassign them or whatever. That file is 
reproduced below.

Please Note that when HOOK is active, any changes to HOOK.DAT may be made 
active by pressing Shift-Alt-UpArrow. IF the EDIT option was chosen from the 
Pop Up Menu the changes automatically are read into HOOK.EXE when the Editor 
is exited. Either choice re-reads this file into the Hot Key Record Structure.
If a Hot Key exists that is defined in HOOK,DAT, it is overwritten, otherwise
current Hot Keys are not disturbed and any Hot Keys defined in HOOK>DAT not
in the Hot Key record structure are added to it.

Displayed below is the content of HOOK.DAT supplied for you initially.

 ***************** Beginning of File HOOK.DAT *****************
;; HOOK.DAT Key Assignment file for HOOK.EXE   Sun  12-11-94
;;
;; This file  MUST be located in the directory X:\HOOK????
;; where X and ???? were chosen by the user at install time
;;
;; NB the actuating Key strokes are Shift-Alt-X, Shift-Ctrl-X, Alt-Ctrl-X
;;
;; <<<<<<<<<<<<<<<<<<<<<<< The format is as follows >>>>>>>>>>>>>>>>>>>>>>
;;
;; A ";" indicates a comment and text from there to end of line is ignored
;;
;; Blank Lines are not allowed - place at least one ";" on any line
;;
;; There must be at least 1 space between each field and the next field.
;;
;; The first field in a line is either A#, C# or Q# indicating an assignment to
;; Shift-Alt-#, Shift-Ctrl-# or Alt-Ctrl-# where #  is  0,1,2,3,4,5,6,7,8,9 or
;; AX, CX, QX indicating assignment to to Shift-Alt-X, Shift-Ctrl-X, Alt-Ctrl-X
;; where X is any letter from a .. z.
;;
;; No distinction exists between LowerCase or UpperCase.
;;
;; The next field is optional - it allows the user to include a descriptive
;; text (up to 20 characters long) to describe the program. It will appear
;; in the Task List after the Alt|Ctl|Qac-X Hot Key indicator
;; The text to be included must be between @-------@ as
;; @Fox Pro 2.0@
;;
;; The next set of (4) fields are collectively optional and allow the user
;; the ability to set the location and size of the Window.
;; They are entered as           x|X### y|Y### w|W### h|H###
;; where x|X y|Y w|W h|H denote the coordinates of the lower left corner
;; of the window and w|W / h|H denotes the Width / Height of the window.
;; All sizes are given in PELS so that a set of values OK for one screen
;; resolution will appear differently for another.
;; x0 y0 w300 h400 will create a window located at the lower left corner
;; of the Screen whose size is 300 pels wide and 400 pels high.
;;
;; The next field has the following options.
;;
;; 9 means that the key will not be recognized. This can be accomplishied
;;   as well by commenting that assignment out with ";
;; ;Ad        means that Shift-Alt-D is not assigned
;; Ad 9 a 0   means that Shift-Alt-D is not assigned
;;            the 9 must be followed by any letter a space and "0"
;;
;; OR just omitting Ad from the text also means it is not assigned
;;
;; Otherwise the field has the following meaning
;;
;; 0   Allows the Shell to establish the session type - best as a rule
;; 1   Starts program as Full Session OS/2
;; 2   Start Program in Windowed Session for programs using Base Video System
;; 3   Start Program in Windowed Session for programs using PM services
;; 4   Start Program in Full Screen DOS session
;; 7   Start Program in Windowed DOS session
;; !! A value of 5 is used if the program is to be loaded with the 0
;; !! option but is a program that takes a long time to load, such as many
;; !! programs with options 3 or 4. This allows HOOK to set a flag that
;; !! ensures the Title to be displayed in the Task List (@......@)
;; !! is not correctly done.
;;
;; The next field is the file spec of the program to be executed and the
;; field after that is either a "0" indicating no  command line parameters
;; or the command line parameters. If the command line parameters contain
;; any spaces the command line parameters must be contained within "".
;;
;; Ae 0 c:\os2\e.exe c:config.sys ; loads the system editor included in OS/2
;;                                  to edit c:config.sys and assigns  this
;;                                  command to Shift-Alt-e
;;
;; Ae @Edit Config.sys@0 c:\os2\e.exe c:config.sys ; loads the system editor included in OS/2
;;                                  to edit c:config.sys and assigns  this
;;                                  command to Shift-Alt-e displays description
;;                                  "Edit Config.sys" in Task List
;;
;; Generically speaking the format below assigns programfilespec to Shift-Alt-x
;;
;; Ax 0 programfilespec "program command line" ;if there are command line parms
;;
;; Ax 0 programfilespec  0                     ;if no command line parms
;;
;; The  programfilespec must contain the extension .COM / .EXE / .BAT
;; BAT files can be loaded just like EXE files
;;
;; HOOK  uses the DosStartSession Function of the OS/2 API to load programs.
;; It is documented on page 2-345 of the Control Program Functions Manual.
;;
;; DosStartSession does not like to load a CMD file directly so they must be
;; loaded with a command processor as
;;
;; A5 0 c:\os2\cmd.exe abcdef.cmd ; abcdef.CMD loaded by OS/2 command processor
;;
;; To assign a program to a key follow the examples/rules above
;;
;; If you edit this file while HOOK is Active, press Shft-Alt-UpArrow
;; to re-read this file in and redefine the Active Set of Keys
;;
;; !!IF  this file is edited from the HOOK Menu, it is automatically re-read!!
;;
;; In the Task List Shift-Alt-Key assignments are identified as Alt-X
;; In the Task List Shift-Ctl-Key assignments are identified as Ctl-X
;; In the Task List Alt-Ctrl-Key  assignments are identified as Qac-X
;;
;; Please Note that As is assigned to Search and Replace Applet which may
;; not be valid for other than vs.2.1 and Cw  for Windows is valid only for
;; OS/2 2.0/2.1 not for WARP!!
;;
Q3 @3:OS/2 Command@ 0 c:\os2\cmd.exe 0               ;OS/2 window using OS/2 Command Processor
A1 @1:OS/2 Command@ 0 c:\os2\cmd.exe 0               ;OS/2 window using OS/2 Command Processor
A2 @2:OS/2 Command@ 0 c:\os2\cmd.exe 0               ;OS/2 window using OS2 Command Processor
A3 @3:OS/2 FScreen@ 1 c:\os2\cmd.exe 0               ;OS/2 Full Screen using OS/2 Command Processor
A4 9 x 0                            ;Key not assigned
A5 9 x 0                            ;Key not assigned
A6 9 a 0                            ;Key not assigned
A7 9 x 0                            ;Key not assigned
A8 9 a 0                            ;Key not assigned
A9 9 a 0                            ;Key not assigned
A0 9 x 0                            ;Key not assigned
Aa 9 a 0                            ;Key not assigned
Ab 9 x 0                            ;Key not assigned
Ac 9 x 0                            ;Key not assigned
Ad 9 a 0                            ;Key not assigned
Ae @System E Editor@ 0 c:\os2\e.exe 0    ;OS/2 e.exe  system editor
Af 9 x 0                            ;Key not assigned
Ag 9 x 0                            ;Key not assigned
Ah 9 x 0                            ;Key not assigned
Ai 9 x 0                            ;Key not assigned
Aj 9 x 0                            ;Key not assigned
Ak 9 x 0                            ;Key not assigned
Al 9 x 0                            ;Key not assigned
Am 9 x 0                            ;Key not assigned
An 9 x 0                            ;Key not assigned
Ap 9 z 0                            ;Key not assigned
Aq 9 x 0                            ;Key not assigned
Ar 9 z 0                            ;Key not assigned
As @Search and Seek@ 0 c:\os2\apps\pmseek.exe 0       ;OS/2 Search and Scan Applet
At 9 z 0                            ;Key not assigned
Au 9 z 0                            ;Key not assigned
Av 9 x 0                            ;Key not assigned
Aw 9 z 0                            ;Key not assigned
Ax 9 z 0                            ;Key not assigned
Ay 9 z 0                            ;Key not assigned
Az 9 z 0                            ;Key not assigned
C1 @1:DOS Command@ 7 c:\os2\mdos\command.com  0     ;DOS window using built in DOS
C2 @2:DOS Command@ 7 c:\os2\mdos\command.com  0     ;DOS window using built in DOS
C3 @3:DOS FScreen@ 4 c:\os2\mdos\command.com  0     ;Full Screen using built in DOS
C4 9 a 0                            ;Key not assigned
C5 9 a 0                            ;Key not assigned
C6 9 a 0                            ;Key not assigned
C7 9 a 0                            ;Key not assigned
C8 9 a 0                            ;Key not assigned
C9 9 a 0                            ;Key not assigned
C0 9 a 0                            ;Key not assigned
Ca 9 a 0                            ;Key not assigned
Cb @QBasic@ 7 c:\os2\mdos\qbasic.exe 0       ;QBasic from dos in DOS window
Cc 9 a 0                            ;Key not assigned
Cd 9 a 0                            ;Key not assigned
Ce 9 a 0                            ;Key not assigned
Cf 9 c 0                            ;Key not assigned
Cg 9 b 0                            ;Key not assigned
Ch 9 c 0                            ;Key not assigned
Ci 9 c 0                            ;Key not assigned
Cj 9 d 0                            ;Key not assigned
Ck 9 e 0                            ;Key not assigned
Cl 9 f 0                            ;Key not assigned
Cm 9 c 0                            ;Key not assigned
Cn 9 g 0                            ;Key not assigned
Co 9 h 0                            ;Key not assigned
Cp 9 c 0                            ;Key not assigned
Cq 9 c 0                            ;Key not assigned
Cr 9 i 0                            ;Key not assigned
Cs 9 j 0                            ;Key not assigned
Ct 9 k 0                            ;Key not assigned
Cu 9 l 0                            ;Key not assigned
Cv 9 m 0                            ;Key not assigned
Cw@Windows 3.1@ 4 c:\os2\mdos\winos2\win.com 0   ;OS/2 DOS Win 3.1 Full Screen
Cx 9 o 0                            ;Key not assigned
Cy 9 p 0                            ;Key not assigned
Cz 9 q 0                            ;Key not assigned
<***************** End of File HOOK.DAT *****************>

When programs are loaded by a Hot-Key their title appears in the
Task List (actuated by Ctrl-Esc) according to the following rules.

IF A TITLE WAS NOT ASSIGNED USING @ASSIGNED TITLE@ then

   If assigned to a Shift-Alt key combination it appears as
       Alt-X name_as_assigned_in_field_3     where X is key assigned

   If assigned to a Shift-Ctrl key combination it appears as
       Ctl-X name_as_assigned_in_field_3     where X is key assigned

   If assigned to a Alt-Ctrl key combination it appears as
       Qac-X name_as_assigned_in_field_3     where X is key assigned


In each case the string "name_as_assigned_in_field_3" contains up to
a total of 24 characters from the filespec of the program to be
loaded appended to "Alt-X ",to "Ctl-X " or to "Qac-X ".

The reason for this is two fold. Most importantly it is because the
program uses the Task List titles to determine if a program is
currently active when that hot-key combination is struck and it
switches to the running program. Secondly in the Task List it
serves as a convenient reminder of the current hot-key assignments.


The examples below reflect the Task List Title  for some of the
assignments above in the sample DAT file. IF THEY DID NOT
INCLUDE AN ASSIGNED TITLE IN @.......@

Alt-E c:\os2\e.exe                 ;OS/2 e.exe  system editor
Alt-S c:\os2\apps\pmseek.exe       ;the pmseek program
Ctl-W c:\os2\mdos\winos2\win.c     ;Win 3.1 (note the "om" missing)
Ctl-3 c:\os2\mdos\command.com      ;DOS window

Please note that if the Alt-E assignment had been made as
Ae 0 C:\OS2\e.exe 0                 ;OS/2 e.exe  system editor
then its Task List title would appear as
Alt-E C:\OS2\e.exe 0

IF the program had a title assigned between @ASSIGNED TITLE@ then
that text would appear after the Alt-X or Ctl-X in the Task List.

Programs not loaded by HOOK hot-keys will have their Task List titles
reflect how the program is written. PM programs may have their Task List
title reflect either the Program Name or the title that appears in their
Window when loaded. In some cases the title bar is updated dynamically.


The hot-keys Shift-Alt-/ ,Shift-Ctl-/ and Alt-Ctl-/ display on the
screen a listing of the Hot-Key assignments in HOOK.DAT relevant to
those hot keys. This screen listing is automatically read from the
active listings in HOOK.EXE and displayed. This screen is removed by Esc
or Shift-Alt-Esc.

It is also useful to load separate window programs seamlessly so that
they may be loaded and switched between with hot keys. The line below
indicates this for MathCad assigned to Shift-Alt-M for OS/2 2.1

Am @Win MathCad@ 3 4os2.exe "Start /win /c e:\winmcad\mcad.exe &amp. exit"
  ;OS/2 DOS Win 3.1 Windowed Switchable

The command processor defined by the OS/2 COMSPEC variable in the
environment is used for the PopUp Command Window activated by the key
combination Shift-Alt-Ins.

HOOK.EXE may be started by placing the appropriate command in a
STARTUP.CMD file, by entering it from an OS/2 Window or from a Folder
Icon by creating a Program Folder and assigning the Hook location to the
Menu in that folder.

From the command line or startup.cmd use:

Start X:\HOOKdir\HOOK     IF X:\HOOKdir not in Path

Start HOOK                IF X:\HOOKdir is in Path

TWO FINAL CAVEATS.

Some programs take a long time to load and even if the session type is
set as 3 or 4 to try to allow for this it does not always work. In
addition, some programs change their Task Title when in use (one example
is the Dialog Editor). In either case the Task List does not contain a
Title the program can swtich to using the Task List as a basis. An
attempt has been made to allow for this by storing the program's window
handle when it is loaded and if the Task List Title search does not
succeed, an attempt to load using the Save Handle is made. This usually
works so that a loaded program can be accessed even if its Task List
Title has been changed.

It is important to remember that the status of the DLL configuration may
affect the playing back of macros. In particular if the macro is a
playback of keystrokes, the target window must have the focus and this
means that the default DLL setting is required.

RECORDING AND PLAYING BACK MACROS

To begin the recording of KeyStrokes and/or Mouse Actions press
Shift-Ctrl-LeftArrow or Shift-Ctrl-[. The program window will display a
Window Message Prompting you with respect to your first recording action
and will then display "Recording" as long as the recording is on. To
conclude the recording press Shift-Ctrl-RightArrow or Shift-Ctrl-] and
the window will be closed indicating recording is ended. You will also
at this point be presented a file dialog box to select a name under
which to save the Macro. To abort Saving the Macro just enter Esc.

The availability of the optional Shift=Ctrl-[ to begin Macro recording
and Shift-Ctrl-] to end recording is made to make recording and play
back easier for those editors (such as e.exe, epm.exe and others) which
use the Shift-Cursor keys for Text marking and Cut and Paste operations.

To PlayBack the Macro just recorded press the Shift_Ctrl-Ins key and
the window will display the message "Playback" while it is playing back
the events recorded.

A Macro may also be saved after it has been recorded (if the original
prompt for saving was ignored) by pressing Shift-Ctrl-PgDn. A
dialogue box will be presented prompting you for the name of the macro
file to be stored. The macro is written to X:\HOOKdir with the
assigned name in two forms. One form is the binary form that is playable
back and has the extension HEX. The other form is in ASCII with the same
name but extension MAC and is a listing of the following parameters
recorded in the Macro; the values of all except TaskListName are given
in HEX.(X above is the drive letter chosen by the user in Install.)

Handle MessageID msgParam1 msgParam2  msgTime  X_ScreenP Y_ScreenP TaskListName

To play back a saved Macro, use Shift_Ctrl-PgUp to activate a
dialogue box that will present the list of saved macros. When one is
selected it is read into memory and is activated by Shift_Ctrl-Ins
Any macro that is created or that is read into memory stays there until
replaced by another and thus can be repeatedly used. If a macro is
already in memory it can be played back(repeatedly) by Shift-Ctrl-Ins.

Macros may also be played back from the command line using PLAYBACK.EXE
for general Macros and PLAYKEYS.EXE for macros containing just KB
entries. From an OS/2 command line :

   playback  filespec
       or
   playkeys  filespec

where filespec is the drive:\directory\macroname.hex specification for
the binary file saved by HOOK when a macro was created.

Those commands may also be assigned to Hot-Keys so that frequently used
Macros are readily available.

Again remember that for Key Stroke macros the target window must have
the focus to receive the keystrokes - this implies the DLL default
configuration option.

LIMITATIONS OF MACRO RECORDING

The Macro recorder does not record Alt-Esc or Alt-Tab key strokes.

It will record and play back messages for actions initiated by the Alt
Key and then choosing options from the Control Frame Menu, such as Alt-x
to maximize the window, Alt-r to restore the window, etc. If you record
a macro that includes MOVING or RESIZING the window, when that aspect of
the macro is entered, for reasons I do not yet understand, the system
waits for you to move the cursor keys to either resize or move the
window.

It does record the Ctrl-Esc key sequence and its actions and other
keyboard entries including the Shift-ALt|Ctrl-X keys assigned to this
program and their actions and also mouse actions. It does not however
faithfully play back everything recorded for reasons I also do not
frankly understand. For instance if you assign to a Macro the sequence
(from an OS/2 window) Help DownCursor DownCursor CR, it does not play
back the DownCursor DownCursor CR sequence though it does open the Help
Window.

However if you save (e.g.) the sequence "Help Dir" from a command line it
will play that back correctly.

When you are recording anything from the Command Line, after using the
Shift-Ctrl-LeftArrow (or Shift-Ctrl-[ ) key strokes to start the macro,
you must use the Mouse to activate the window you were in or else an
assigned Shift-xxx-xxx action to get back into that window. This is
because displaying the Message "Recording" in the Hook window makes that
the active window. There is a Prompt reminding the user to make the
shift to the desired active window.

When activating a Macro you must be careful that your setup is similar
to that used when recording it, particularly if writing text is a part
of the scenario - you might get the text written back in a non-intended
window.

Since the macros when recorded, record positions in screen coordinates,
which are absolute relative to the bottom left corner, any actions
depending on a mouse action such as clicking on a minimize or maximize
button will be sensitive to where that button is on the screen. If a
window is not displayed at exactly the same position as it was when
recording, those mouse actions will not be what is intended.

The macros do a good job of recording keystrokes and their playback is
faithful and fast. However if the Keystrokes were recorded from a
non PM window they will only play back to a non-PM window and vice
versa.

I find the macros most useful for storing and setting up different
groups of windows. For instance I have one mode of operations where I
have my editor open in two different OS/2 windows, 2 DOS windows open
with different versions of FoxPro in them and an OS/2 window for command
line use. I have that set of keystrokes assigned to a macro I have named
to FOXLOAD.HEX and  when I want to re-establish that set of windows I
load it into memory using Shift_Ctrl-PgUp to select and load it and play
it back with Shift-Ctrl-Ins.

The KB macros (using PlayKeys.exe assigned to Hot-Keys) have been found
useful by people who need to type special characters or special
character sequences frequently.

Finally the Buffer used to store the messages is of finite size. Each
message is 28 bytes long and the buffer size is 56000 bytes and thus
holds  2000 messages. If your recording exceeds the buffer size the
program notifies you.

The program macro PlayBack facility will now run under either OS/2
version 2.0 /2.1/WARP as it determines the Handle of the Task List
Window on the Fly, in this respect it should be immune to updates. The
messageID of the Task List is not documented but it is 082H and it has a
fixed handle value that changed from version 2.0 to 2.1. The value is
stored in the Task List Buffer at offset 8, which is where I get it on
loading HOOK.

Currently the macros are not played back at the speed at which they were
recorded but somewhat faster. This is because it is presumed and
certainly I do, that one uses Macros for convenience and speed. That
sometimes gives a problem, especially if mouse movements are involved.
For opening up icons on the screen I find it convenient to follow the
procedure of going to the desktop, (or other window as the case may be)
and clicking the left mouse button to establish the location, then press
the Home key to bring you to the upper left icon of that window, and
then use the cursor keys to bring you to the desired icon to open and
then press enter to open it and so on.

DOS WINDOWED SESSIONS and FULL SCREEN SESSIONS

There are limitations to using the Macro Recorder from a DOS session. It
will record and play back actions reflecting OS/2 aspects, such as using
the Alt key to activate a frame menu and select an options, such as
Alt-x (maximize),etc or Ctrl-Esc to activate the Task List and make a
selection but it will not record ordinary keyboard entry or any activity
from within a DOS session relating to the DOS software program. That is
because in DOS the PM message queue is not active and normal DOS KB
TSR's are required if you need to intercept Keystrokes in DOS.

A similar comment holds for OS/2 Full Screen. There monitors are
required to read Keyboard Activity and the PM message queue does not
apply.

If I need to use an application in Full Screen, then I use Ctrl-Esc
to bring up the TaskList window and from there the Hot Keys are valid
since you are in PM.

Notwithstanding the limitations above, I have found this most useful and
it is worth playing around with to understand both its utility and its
limitations.

FULL SCREEN APPLICATIONS

INCLUDING FULL SCREEN APPLICATIONS

If you have an application that you want to run in Full Screen then in
HOOK.DAT so define it by entering the number 1 OR 4 in the column following 
the key id, AltX 1  or CtrlX 4 if you want the session to be Full Screen 
OS/2 OR Full Screen DOS respectively. From the Define Hot Key Menu the 
choice is clear.

Doing it this way assigns the Task List Title the name Alt-X or Ctl-X as
when loaded with the 0 option or 7 option. This means that the program is 
loaded Full Screen with the assigned Key Combination and if the program is 
already loaded, it can be switched to from the desktop by hitting its 
Hot-Key and if you are in the full screen mode, then pressing Ctrl-Esc 
brings up the Task List, which is a PM and the hot keys are active from 
there. This means that switching to Full Screen applications from the 
Desktop is the same as if they are windowed and switching back from Full 
Screen applications takes only 1 more Key Combination to switch to a 
Windowed Application. Similarly switching between Full Screen applications 
also takes only one more Keyboard action, the Ctrl-Esc to the Task List and 
then the use of the appropriate Hot-Key.

ABOUT THIS PROGRAM

HOOK vs. 3.01

This program and its accompanying DLLs was written in 32 bit Assembler.
The assembler used was Microsoft's MASM 6.00b and the OS/2 2.1 ToolKit
and its resources were used for compiling the INF file and the resource
files used.

If you have any interest in obtaining the source code and how to
assemble it, contact me via compuserve or at the address indicated
below. The program is FreeWare.

           Morton F. Kaplon                 June 14, 1995  
           1047 Johnston Drive
           Bethlehem PA 18017

           Voice: 610/758-9686    FAX: 610-758-9262

           CompuServe ID 73457,437

