home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / kl.zip / KL140L.ZIP / KL.DOC next >
Text File  |  1997-03-16  |  20KB  |  403 lines

  1. ******************************************************************************
  2. *                                                                            *
  3. *        User's Guide of KL (KEDIT FileList) macro            (Ver 1.4)      *
  4. *                                                                            *
  5. *                                                                            *
  6. *        Author: Shintaroh Hori                    ( Yamato Lab, IBM Japan ) *
  7. ******************************************************************************
  8.  
  9. Introduction
  10. ------------
  11.    KL macro is designed to provide functions similar to what are given by
  12.    FILELIST EXEC in CMS environment and by OS2FL program on OS2TOOLS disk.
  13.  
  14.    KL macro displays a list of information about files that meet file specifier
  15.    given to the macro as an argument. The list is displayed in a KEDIT file,
  16.    so you can use KEDIT subcommands to manipulate the list itself. Like
  17.    FILELIST EXEC, you can issue an OS/2 command typed in Cmd Area of the list
  18.    against the file by pressing an 'Execute' key.
  19.  
  20.    You can also issue KL unique commands from the list to sort the list, to
  21.    refresh the list, and so on.
  22.  
  23.    Unlike the FILELIST EXEC, the list file is added to a current KEDIT ring
  24.    whenever the KL is invoked to list files.  (You can have multiple KL list
  25.    files on the ring.)
  26.  
  27.    Default field length of File Name and Extension is 20 and 8, respectively.
  28.    They can be changed by an KL profile.
  29.  
  30.  
  31. Installation
  32. ------------
  33.    1. Copy KL.KEX and KLDIR.KEX macros under any directory that KEDIT can
  34.       search for.
  35.  
  36.    2. (Optional, but strongly recommended)
  37.       Define an 'Execute' key in your KEDIT profile. It is defined as follows:
  38.  
  39.          DEFINE  key_name 'macro KL /ENTER'
  40.  
  41.       If you have a KML file to define key assignment while in your profile
  42.       and want the key_name to work as both the Execute key in KL's session
  43.       and your original key in non-KL session, insert following line on top of
  44.       definitions for the key:
  45.  
  46.          'macro KL /ENTER'; if rc \=0 then Exit (rc-1)
  47.  
  48.       'KL /ENTER' does *NOTHING*, but sets Return Code 0 when it is invoked
  49.       from a non-KL session, and sets Return Code 1 when it is invoked from
  50.       a KL session, thus behavior of the key in a non-KL list is not modified.
  51.  
  52.    3. (Optional)
  53.       If you want a key to cause a OS/2 command executed against a file where
  54.       a cursor is placed on a KL list file, and want the same key to work as
  55.       usual when in non-KL session, insert following line on top of definitions
  56.       for the key in your KML file:
  57.  
  58.          'macro KL /EX  your_command_string '; if rc \=0 then Exit (rc-1)
  59.  
  60.       Example:
  61.          To define F4 key to upload the file to A-disk of host session A,
  62.          a part of your KML file for F4  should look as follows;
  63.  
  64.          :F4
  65.             'macro KL /EX  ALMCOPY / HA:= = A'; if rc \=0 then Exit (rc-1)
  66.             /* your original F4 definitions follow after this ... */
  67.  
  68.  
  69.    4. (Optional)
  70.       You can define keys to retrieve KL commands from a KL command buffer
  71.       backward or forward when the keys are pressed on a line of KL list, and
  72.       to retrieve commands from a KEDIT command buffer backward or forward
  73.       when the keys are pressed on a KEDIT command line.
  74.  
  75.       Example:  Define C-CURU and C-CURD macros in your KML file as follows;
  76.          :C-CURU
  77.            'macro KL /getcmd -' /*Get KL Cmd BkWrd*/;if rc \=0 then Exit (rc-1)
  78.            'sos retrieveB' /* Retrieve cmd from KEDIT cmd line */
  79.            Exit
  80.  
  81.          :C-CURD
  82.            'macro KL /getcmd +' /*Get KL Cmd ForWrd*/;if rc \=0 then Exit (rc-1)
  83.            'sos retrieveF' /* Retrieve cmd from KEDIT cmd line */
  84.            Exit
  85.  
  86.       Note: Though you can use "?n" command on a line of KL list alternatively,
  87.             these setting are more useful than ?n KL command.
  88.  
  89.    5. (Optional)
  90.       Create KL profile "KLPROF.KL" on the path specified by DEFPROFILE option
  91.       of KEDIT, if you want to customize KL macro.  See "KL Profile" section
  92.       for more detail.
  93.  
  94.  
  95. Functions and Command syntax of KL macro
  96. ----------------------------------------
  97.  
  98.                                     ┌──────────────┐
  99.                    (a)                            │
  100.    ────KL─────┬───────file_spec──────┬────────┬──┴────────────┬──────
  101.                 │                      ├──/Dn───┤               │
  102.                 │                      └──/ADD-─┘               │
  103.                 │  (b)                                          │
  104.                 ├────────slash_cmd──────────────────────────────┤
  105.                 │                                               │
  106.                 │  (c)                                          │
  107.                 ├────────/ENTER-────────────────────────────────┤
  108.                 │                                               │
  109.                 │  (d)                                          │
  110.                 ├────────/EX───cmd_string-──────────────────────┤
  111.                 │                                               │
  112.                 │  (e)                                          │
  113.                 └────────/GETCMD───sign─────────────────────────┘
  114.  
  115.    Syntax (a):
  116.      Used to list files that meat a file specification, file_spec.
  117.      file_spec is a file specifier that is used in OS/2 DIR command's argument.
  118.      When /Dn, where n should be a number, is specified,  search for files
  119.      and sub-directories is applied to directory tree of n-level under
  120.      path of the file specifier. If n is omitted, it is default to 1.
  121.  
  122.      If /ADD is used from an existing KL list file, then a list of files is
  123.      appended to the last line of the KL list file instead of opening a new
  124.      KL list file on a KEDIT ring.
  125.  
  126.    Syntax (b):
  127.      Used to operate on KL list itself. An example is sorting of the list.
  128.      slash_cmd is a slash commands that is described in the section 'Valid KL
  129.      command'.  Though this command syntax is used from KEDIT command line,
  130.      slash_cmd itself can be entered in Cmd Area of KL list file and is
  131.      executed by pressing an Execute key.
  132.  
  133.    Syntax (c):
  134.      It causes 'Execute Action' so that any KL commands typed from Cmd Area
  135.      of the KL list be executed from top to bottom of the list.
  136.      It's better to define an Execute key in processing KEDIT profile as
  137.      as described in the section 'Installation'.
  138.      For detail on 'Execute Action', see 'Issuing KL commands from a KL List'
  139.      section.)
  140.  
  141.    Syntax (d):
  142.      Used to assign a key a pre-defined KL command and to invoke the command
  143.      by pressing the key.
  144.      When the key is pressed on a line of the list,  cmd_string is executed as
  145.      if cmd_string is typed on the line and an Execute key is pressed.
  146.      It's useful to assign some keys commands that you use frequently.
  147.      (See also the step 3 of the section 'Installation'.)
  148.  
  149.      KL macro of this syntax does NOTHING when invoked from KEDIT command line.
  150.  
  151.    Syntax (e):
  152.      Used to assign a key to retrieve previous KL command backward or forward
  153.      from a KL command buffer when the key is pressed on a line of KL list.
  154.      sign should be "+" to retrieve forward, and anything else to do backward.
  155.  
  156.  
  157.    Note: KL macro of syntax (b), (c), (d), and (e) does NOTHING but sets return
  158.          code 0 if it is NOT invoked from a KL list file, and sets 1 if it is.
  159.                 ----------------------------------------
  160.          When KL macro of syntax (d) and (e) is invoked from a KEDIT command
  161.          line, it also  sets return code 0 without anything.
  162.          You can use RC from KL macro to get around KEDIT's global definition
  163.          of keys. (See step 2, 3, and 4 in the section 'Installation'.)
  164.  
  165.  
  166. Layout of a KL list file
  167. ------------------------
  168.    (a) File Specifier line:
  169.     File Specifier line is displayed on top of screen of the list file as
  170.     KEDIT reserved line(s). The line starts with '#N=' followed by the file
  171.     specifier given to the KL macro.  N is a one-digit number starting from
  172.     1 through 9. When KL is invoked with /ADD option from a list file of KL,
  173.     a list of files for the specifier is appended to the last line of the KL
  174.     list instead of opening a new list file, and another File Specifier line
  175.     is added below the last File Specifier Line.  (Refer to Syntax (a) of KL
  176.     macro.)
  177.  
  178.    (b) Field description line:
  179.     Field description line is also displayed below the last File Specifier line
  180.     as a KEDIT reserved line to show items of information about listed files.
  181.  
  182.    (c) Information lines:
  183.     Information lines are put in a file area, and each line consists of a
  184.     command space('Cmd Area') and information fields of the listed files.
  185.     The fields are FileName, Extension, Attribute, Size, DateTime, Specifier_ID,
  186.     and Relative_Path, from left to right.
  187.  
  188.     Default length of FileName and Extension fields are 20 and 8, respectively
  189.     (It can be changed by a KL Profile.)
  190.  
  191.     Specifier_ID for a file points to a File Specifier line, which indicates
  192.     a home path of the file, that is, a drive and subdirectory part of the
  193.     file specifier.  (Home path is a terminology used in this DOC.)
  194.  
  195.     Relative_Path indicates path of the file under the home path. This field
  196.     is blank when the KL list is shown without /D option.
  197.  
  198.     Path of a file in the list can be identified by home path and Relative_Path.
  199.  
  200.    (d) KEDIT command line:
  201.     KEDIT command line is given at bottom of the list file.
  202.  
  203.  
  204. Issuing KL commands from KL List
  205. --------------------------------
  206.    You can issue KL command, that is, DOS command, OS/2 command, and/or
  207.    KL specific command, directly from an information line of the list. You do
  208.    this by typing the command from Cmd Area of the line, and then pressing an
  209.    Execute key.  (Instead of the Execute key, you may issue "KL /ENTER" from
  210.    KEDIT's command line.)
  211.  
  212.    Even if the command is longer than Cmd Area field, you can just continue
  213.    typing over the information in the line. Maximum command length that you can
  214.    type is twice of physical screen width. (When the width is 80, the maximum
  215.    is 160.)
  216.  
  217.    Note, however, that you *MUST NOT* make such modifications of the
  218.    information in the line as follows:
  219.  
  220.      1) To delete all the characters right to the end of the command string.
  221.         In default KEDIT setting, it can be done by Ctrl-END key.
  222.      2) To change field position of the information in the line by DEL key or
  223.         INSERT key, for example.
  224.  
  225.    This is because the KL macro maintain the same information also at column
  226.    position starting at (2*physical_screen_width +1).
  227.  
  228.    A command string may contain slash character sequence to represent a drive
  229.    letter, file name, file extension, and so on, just like FILELIST EXEC or
  230.    FL.EXE. (See the section 'Slash Substitution' for more detail.)
  231.  
  232.    If a KEDIT command line includes a command when an Execute key is pressed,
  233.    the command is executed(after execution of prefix commands if existed in a
  234.    prefix command area, which is turned off by KL default,)  and any KL
  235.    commands are NOT executed even if they are typed in the list. To execute the
  236.    KL commands, press the Execute key again.
  237.  
  238.    If there is no KL commands typed in the list, pressing the Execute key moves
  239.    a cursor to a KEDIT command line. (If a prefix command existed in a prefx
  240.    command area, then it is executed.)
  241.  
  242.    When a KL command other than '=' and '?n' is executed, the KL command is put
  243.    into a retrieve buffer for a current KL list. Up to 20, KL default, of the
  244.    latest commands are kept in each KL session. The default value can be
  245.    changed by KL profile.
  246.  
  247.    When a command other than KL slash commands is executed from an information
  248.    line, a current drive and directory are changed to ones for the file in the
  249.    line before its execution. After the execution, they are restored to the
  250.    original drive and directory.
  251.  
  252.    You can type multiple commands and execute them by pressing an Execute key.
  253.    In this case they are processed from top to bottom of the list, though it
  254.    ignores all the commands after a KL slash command, if it is included. (For
  255.    a KL slash command, See 'Valid KL commands' section.)
  256.  
  257.    Note:
  258.      If a full specification of a file on KL list includes blank characters,
  259.      be careful to pass the file id to a KL command other than X, KL, and DEL.
  260.      You will need to enclose the file id with two double-quote. (For example,
  261.      type "/" instead of /.)
  262.      For X, KL, and DEL, the enclosure by two double-quotes is done internally,
  263.      so you must not type the double-quotes for the KL commands.
  264.  
  265.  
  266. Valid KL commands
  267. -----------------
  268.    There are two types of KL commands to be entered in Cmd Area for execution:
  269.      (a) Slash commands
  270.      (b) Non-slash commands
  271.    The first ones operate for KL list file itself, and the second for a file
  272.    that a KL command is entered for. They are executed by pressing Execute key.
  273.    Note that they are NOT case sensitive.
  274.  
  275.    (a) Slash commands
  276.         /R          ; Refresh a KL FileList
  277.         /S<+|->opts ; Sort a KL list by fields specified opts, which is string
  278.                       of characters representing the fields. Valid characters
  279.                       are
  280.                        N -- Name of the file
  281.                        E -- Extension of the file
  282.                        A -- Attribute of the file
  283.                        S -- Size of the file
  284.                        D -- Date of the file
  285.                        R -- Relative Path of the file
  286.                      If opts is prefixed by either + or -, sort order is
  287.                      Ascending or Descending, respectively. Default is Ascending.
  288.         /F<+|->     ; Move to a normal file on the Ring.
  289.                       Option '+', default, indicates Forward, and '-' Backward.
  290.         /L<+|->     ; Move to a KL list file on the Ring.
  291.                       Option '+', default, indicates Forward, and '-' Backward.
  292.         /Q          ; Quit from KL FileList session
  293.  
  294.    (b) Non-Slash commands
  295.         =           ; Execute a last command for the file
  296.         ?           ; Retrieve a last command string
  297.         ?n          ; Retrieve a command string n times before.  ( ?1 = ? )
  298.         X   dirfile ; Open the file that is added to a KEDIT Ring if dirfile is
  299.                       not a directory. If so, a new KL list is created for
  300.                       the directory.
  301.                       (XEDIT, K, or KEDIT can also be used instead of X.)
  302.         KL  dirfile ; Open a new KL list file with dirfile as an argument of
  303.                       the KL macro, even if dirfile indicates a file.
  304.         MAC macstr  ; Character string of macstr after slash substitution is
  305.                       executed as a KEDIT macro from the KL list file.
  306.                       (MACRO can also be used instead of MAC.)
  307.                       Example:
  308.                         mac msg /d/p
  309.                           will display character string after slash substitution
  310.                           is made for /d/p in KEDIT message area. Useful to
  311.                           check if the substitution is what you expect or not.
  312.                         mac cmsg /d/p/n
  313.                           will put character string into KEDIT command line
  314.                           after slash substitution is made for /d/p/n.
  315.         R           ; Rename the file or the directory. (REN can also be used.)
  316.         DEL         ; Delete the file or Remove the directory.
  317.                       (DELETE can also be used.)
  318.         DOS  cmdstr ; Execute cmd for the file via Kedit's DOS command
  319.         DOSN cmdstr ; Execute cmd for the file via Kedit's DOSNowait command
  320.         DOSQ cmdstr ; Execute cmd for the file via Kedit's DOSQuiet command
  321.  
  322.         Any other character string than defined above are executed through
  323.         Kedit's DOSNowait command, which is a default of KL macro and can be
  324.         changed by a KL profile.
  325.  
  326.  
  327. Slash Substitution
  328. ------------------
  329.    If a command string typed from Cmd Area of KL list include following slash
  330.    character sequence and an Execute key is pressed, a Slash Substitution is
  331.    made in the strings and then the substituted strings will be executed.
  332.    The slash character sequence and its definition is as follows.
  333.  
  334.    /N   ; file name of the file
  335.    /E   ; file extension of the file
  336.    /F   ; file name of the file with extension
  337.    /D   ; drive letter of the file                   (e.g. C:, D:, ...)
  338.    /H   ; home path specification of the file        (*1)
  339.    /P   ; path specification of the file             (*1)
  340.    /R   ; RelDir specification of the file           (*1)
  341.    /O   ; escape substitution sequence
  342.    //   ; substitute a slash character(/)
  343.    /    ; full specification of the file             (*2)
  344.  
  345.  
  346.    Note: *1 It always ends with '\'.
  347.          *2 No blank after a single slash is required. When a slash is followed
  348.             by character string that does not begin with N, E, F, D, H, P, R,
  349.             O, or another slash(/), then the string is concatenated to the
  350.             full specification of the file.
  351.  
  352.    When there is no slash characters in the command string, a blank and a slash
  353.    character are appended to the end of the string before the substitution.
  354.    If you do not want the blank and the slash to be appended to the command
  355.    string, place /O anywhere in the command string.
  356.  
  357.  
  358. KL Profile
  359. ----------
  360.    You can change some of KL default settings by creating your KL profile
  361.    "KLPROF.KL" on the path specified by DEFPROFILE option of KEDIT command or
  362.    of KEDIT environment variable. Unless the profile exist on the path, it is
  363.    not processed by KL macro.
  364.  
  365.    Format of the profile is;
  366.     . Comment line must begin with a semicolon(;).
  367.     . Non-comment line must take following form:
  368.           keyword  value
  369.  
  370.    Valid keywords, which is case-insensitive, are as follows:
  371.  
  372.       FNLEN   ; Sets length of file name field in KL list
  373.       FELEN   ; Sets length of extension field in KL list
  374.       BUFLEN  ; Sets number of entries in a retrieve buffer for each KL session.
  375.       XMODE   ; Changes a default shell command DOSNowait for non-slash KL
  376.                 commands to whatever you specified. It would be DOS, DOSNowait,
  377.                 DOSQuiet, or your KEDIT macro name that acts as a shell like
  378.                 DOS/DOSN/DOSQ commands.
  379.       RSVLINE ; Displays an additional reserved line in a KL list file.
  380.                 The Value must be valid operand of 'SET RESERVED' command.
  381.                 Useful to display information of your key assignment in KL list.
  382.                 (There may be multiple RSVLINE lines.)
  383.  
  384.    Notes:
  385.       1) KL macro does not check validity of values in KLPROF.KL.
  386.       2) If sum of FNLEN and FELEN values exceeds 28, a Field description line
  387.          would be truncated when screen width is 80.
  388.  
  389.  
  390. Notice on KEDIT profile
  391. -----------------------
  392.   To use KL macro, it is recommended to issue 'SET REPROFILE ON' in your KEDIT
  393.   profile.
  394.  
  395.   KL macro turns off ID LINE and makes Reserved lines on top of screen by KEDIT
  396.   SET commands after it opens a list file using your KEDIT profile.
  397.   If your KEDIT profile does not issue 'SET REPROFILE ON' explicitly, an edit
  398.   session for a listed file has the same Reserved lines as in the KL list and
  399.   no ID LINE is displayed when the file is opened from the KL list.
  400.  
  401.   This is because KEDIT copies over the values of most SET options from a
  402.   current file, the KL list file in this case, to a newly opened file.
  403.