home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / KEYBOARD / CMDED2E5.ZIP / CMDEDIT.DOC < prev    next >
Encoding:
Text File  |  1991-07-14  |  15.3 KB  |  297 lines

  1. UTILITIES
  2. Ashok P. Nadkarni
  3. PC Magazine
  4. Vol. 9, No. 16
  5. CMDEDIT V2.0
  6. plus extensions by David Abbott at version 5,  including /c,k,l,n,o,t,w & z
  7. and additional documentation.
  8. ( David Abbott -> dfa@muon.ph.unimelb.edu.au as at July 1991)
  9.  
  10.  
  11. Purpose: A TSR utility that supplies full editing features to the DOS
  12.          interface; stacks commands and drive/directory pairs for
  13.          recall; supports definable symbols and variables, and
  14.          programmable function-key definitions and macros; provides
  15.          optional autocompletion of commands and filenames; and enables
  16.          changing drives and directories simultaneously.
  17.  
  18. Format:  CMDEDIT [/r] [/i] [/c] [/k] [/t] [/w] [/g] [/n] [/o] [/z] [/u]
  19.          [/p X] [/l N0] [/d N1] [/m N2] [/b N3] [/s N4] [/ffilename]
  20.  
  21. Remarks: CMDEDIT can be entered at the DOS prompt, but is normally installed
  22.          through the AUTOEXEC.BAT file.  Its optional parameters at
  23.          installation are:
  24.                 /r Auto recall mode (default off)
  25.                 /i Use insert mode (default over-type)
  26.                 /c Swap cursor type used in insert and over-type modes
  27.                 /k Use ESC key for filename completion (in addition to TAB)
  28.                 /t Disable all macro and symbol translation (default enabled)
  29.                 /w Use alternate error message display
  30.                 /g Use silent mode (default beeps on error)
  31.                 /n No existence check (default checks for previous install)
  32.                 /o Do not install - (default will install if not already)
  33.                 /z Disable CMDEDIT (default enabled)
  34.                 /p Set the ignore macro character (default X is ;)
  35.                 /l Minimum command length to store in buffer (default N0 is 0)
  36.                 /d DOS command stack buffer (default N1 is 512 bytes)
  37.                 /m Macro buffer size (default N2 is 512 bytes)
  38.                 /b Symbol buffer size (default N3 is 512 bytes)
  39.                 /s Directory Stack size (default N4 is 256 bytes)
  40.                 /f Initialization file to read at start-up (default none)
  41.          In addition,  CMDEDIT can be disabled and removed from memory with /u.
  42.  
  43.      The CMDEDIT Ctrl-key editing actions are:
  44.  
  45.         ^F or Right-Arrow       Cursor forward (character).
  46.         ^B or Left-Arrow        Cursor backward (character)
  47.         ^Right-Arrow            Cursor forward (word)
  48.         ^LeftArrow              Cursor backward (word)
  49.         ^E or End               Cursor to end of line.
  50.         ^A or Home              Cursor to start of line.
  51.         ^D or Del               Delete character at the cursor.
  52.         ^H or Backspace         Delete previous character
  53.         ^W                      Delete word at right of cursor.
  54.         ^L                      Deletes word at left of cursor.
  55.         ^[ or ESC               Erase entire command line (unless /k option
  56.                                 specified on start-up: then same as TAB below).
  57.         ^K                      Delete from cursor to end of line
  58.         ^X                      Delete from cursor to start of line
  59.         ^O                      Delete from cursor to EOL and
  60.                                 execute line.
  61.         ^G                      Erase entire line but keep in stack.
  62.         ^^ (Ctrl-6)             Execute line, but do not store or
  63.                                 display (for passwords).
  64.         INS                     Toggle insert/over-type modes.
  65.         ^I or TAB               Expand partial filename or
  66.                                 directory name (adds\) if possible.
  67.         ^J                      Replace variables with values.
  68.         ^Q                      Place succeeding Ctrl-key on
  69.                                 line as literal instead of command
  70.         ^T                      Equivalent to the /t command line toggle.
  71.         ^Z                      Put end-of-file marker on line.
  72.  
  73.         Commands given at the DOS prompt can be recalled from their buffer
  74. using the Up-Arrow (^U) or Dn-Arrow (^N) keys.  Commands beginning with one
  75. or more user-typed letters can be recalled with ^R or ^V.  In auto-recall
  76. mode, activated either with the /r switch or toggled by ^Y, a command stack
  77. search is made as each letter is typed in.  Note that command lines shorter
  78. than the minimum number of characters specified with the /l switch are not
  79. stored on the stack.
  80.  
  81.         The PUSHD d:\path command changes to and stacks a drive/directory pair.
  82. If at least one pair has been pushed into this buffer, entering PUSHD without
  83. parameters toggles between the current and stored pairs.  POPD changes to and
  84. removes a stacked drive/directory pair, and the CHD d:\path command allows
  85. changing to a drive and directory simultaneously without affecting the stack.
  86.  
  87.         The DEFS symbol string command allows abbreviating a long command (the
  88. string) with one or more characters (the symbol).  By using F1...F0 (for F10)
  89. and SF1...SF0 as the symbol values, the function and shifted function keys can
  90. be programmed to output strings on the command line.  If these strings end in
  91. the @ character they will be executed, as well.  To be expanded into its
  92. defined string, a symbol must be the first word on the command line.  Before
  93. being passed to DOS or to an application the command line is scanned
  94. recursively, so one symbol can define another.
  95.  
  96.          Multi-line command macros are created by issuing the DEFM macro-name
  97. command.  Each line is terminated by hitting Enter, and the macro is terminated
  98. with the ENDM command.  Macro command lines may contain parameters, which are
  99. designated by %n (n is a numeral from 1-9).  Parameters are processed much as
  100. in DOS batch files (see article text).  Macros support DOS batch file commands
  101. such as ECHO, PAUSE, IF, and FOR; see text for restrictions.  Embedded spaces
  102. and tabs in macro command line arguments must be enclosed in pairs of quotes
  103. (").  Macros cannot be nested, and one macro can call another only from the
  104. last line before ENDM.
  105.  
  106.          Macros and symbols also support the use of string variables, which
  107. must be enclosed within % signs.  See the article text for how these are
  108. processed.  Macros and symbols may be deleted by name with the DELM and DELS
  109. commands, respectively, and the respective CMDEDIT buffers can be cleared and
  110. reset with the RSTHIST, RSTSYM, RSTDIR, and RSTMAC commands.
  111.  
  112.          Instructions for preparing an initialization file to load
  113. regularly-used macros and symbols via the /f parameter option are presented in
  114. a side-bar to the main article.
  115.  
  116.  
  117.  
  118.  
  119.                                ADDITIONAL NOTES:
  120.  
  121.  
  122. The CMDSTAT command lists the current macro and symbol definitions.
  123.  
  124.         ^BREAK                  terminates a running macro.
  125.         ^C                      terminates the current command in a macro, but
  126.                                 execution continues with the next command.
  127. (This assumes a running application does not take over these keys)
  128.  
  129. You can define the macro ignore character to be a space.  To do this,  however,
  130. you must put it in quotes.  i.e. use  CMDEDIT /p" "
  131.  
  132. The following switches can be used to toggle or change options after CMDEDIT
  133. has been installed:  /c /g /i /l /o /p /r /t /w and /z.
  134. For example,  to toggle macro and symbol expansion off/on,  use  CMDEDIT /t.
  135.  
  136. The /t and /z switches were added for the benefit of some programs which have
  137. an interactive command input mode in which CMDEDIT is still active.  In these
  138. cases,  symbol expansion is probably not desired as it could conflict with
  139. the other program's own commands.  Auto-recall mode can also lead to similar
  140. problems.  In some cases,  the regular history facility may also interfere,
  141. in which case you should use /z to disable CMDEDIT completely.
  142.      When these problems are known to occur it is probably a good idea to call
  143. the application from a batch file which first calls CMDEDIT with "/o /t" or
  144. "/o /z".  The batch file could then re-enable CMDEDIT with an identical line
  145. once the application exits.
  146.  
  147. The /w switch causes error messages to be displayed without being encased in
  148. "*** CMDEDIT :   ......    Any ongoing macro aborted! ***".  In addition,  the
  149. command line which caused the error is left displayed on the screen.
  150.  
  151. The /o switch is useful when changing CMDEDIT options from a batch file.  If
  152. CMDEDIT had not previously been installed,  the new invocation would normally
  153. make itself resident;  /o prevents this.
  154.  
  155. The /n switch disables the normal existence check which CMDEDIT performs to
  156. find an already resident incarnation.  This switch forces the current
  157. invocation to remain resident (even if CMDEDIT is already resident).  The
  158. switch should only be used if CMDEDIT incorrectly detects the presence of a
  159. resident incarnation.  WARNING:  PROBLEMS MAY OCCUR IF CMDEDIT IS RUN
  160. AGAIN TO CHANGE INSTALLED OPTIONS,  AS THE INCARNATION CHANGED MAY IN FACT BE
  161. THE SPURIOUS DETECTION.  See also BUGS.
  162.  
  163. In initialisation files,  lines beginning with a minus (-) are comments.  Blank
  164. lines are ignored unless they are part of a macro definition.  The file can
  165. contain macro and symbol definitions using such commands as DEFS, DEFM, ENDM
  166. etc., as well as the commands PUSHD, POPD and CHD.  It must not contain
  167. any other commands,  or CMDEDIT will display an error message and exit.  The
  168. format of the commands in the file is the same as if you typed them in from
  169. the keyboard (but see also Bugs below).  e.g. The following is a short example
  170. definition file:
  171.  
  172. defs d dir/w
  173. defm home
  174. chd c:\
  175. endm home
  176.  
  177. Note that the ENDM command is followed by the macro name it terminates. This is
  178. optional,  as CMDEDIT ignores all following characters on a line whose first
  179. word is ENDM.
  180.  
  181. When defining macros and symbols, keep in mind the important differences in the
  182. way command line arguments are handled.  With a symbol, the rest of the command
  183. line is appended to the definition string when it is executed.  A macro on the
  184. other hand uses the %n parameters like DOS batch files.  Thus the following are
  185. essentially equivalent:
  186.  
  187. defs d dir/w
  188.  
  189. and
  190.  
  191. defm d
  192. dir/w %1 %2 %3 %4 %5
  193. endm
  194.  
  195. but without the %n's,  the macro definition would ignore any command line
  196. arguments.
  197.  
  198.  
  199.                                 VERSION HISTORY:
  200.  
  201. Extensions by D. Abbott - v1 and v2: Never released
  202.  
  203. Extensions by D. Abbott - v3 (Jan 14, 1991):  This version is identical to
  204. that published as CMDEDIT v2.0,  with the exception of the /c, /l, /w, /o, /t
  205. & /z switches added by David Abbott (DFA), Nov/Dec 1990. If these switches are
  206. not used,  CMDEDIT will function like the original except for the ^T command,
  207. which previously did not exist.  The resident size of the modified version is
  208. only about 128 bytes larger than the original.
  209.   A bug in the installation code that resulted in false reports of an already
  210. resident version has also been partially fixed.  See below.
  211.  
  212. Extensions by D. Abbott - v4 (May 11, 1991):  Added the /k switch for the
  213. benefit of those used to the Unix C-shell 'filec' filename completion (which
  214. uses the ESC key rather than TAB).
  215.  
  216. Extensions by D. Abbott - v5 (July 14, 1991):  Added the /n switch to counter
  217. installation problems in some situations where CMDEDIT incorrectly detects
  218. that it is already installed.  Added instructions for running CMDEDIT with
  219. Windows 3.0 (see BUGS below).
  220.  
  221.  
  222.                                      BUGS:
  223.  
  224. CMDEDIT will abort with an error if a CTRL-Z end of file character is at the
  225. end of a command file,  unless that line is a comment.  Since most editors put
  226. an EOF character at the end of a file,  you should always make the first
  227. character on the very last line of a command file a minus sign.  Make sure you
  228. don't hit return at the end of the last line!
  229.  
  230. If CMDEDIT is un-installed with /u,  and then run again,  it sometimes reports
  231. that it is already installed.  The original version was worse than this,  in
  232. that on some machines it would report that it had already been installed when
  233. run for the first time.  If you encounter either of these problems,  use
  234. the /n switch to force an initial installation,  but be aware that later
  235. changing installed options is then dangerous as the first incarnation in memory
  236. is always detected and hence changed, and this may be the spurious detection.
  237.  
  238. CMDEDIT cannot detect that it has already been loaded if it was loaded into
  239. high memory by a utility such as QEMM-386.  This means calling CMDEDIT again to
  240. alter an option will instead result in a new copy being installed (unless /o is
  241. specified,  in which case nothing at all will happen).  Some switches,  such as
  242. /r and /t,  have control key equivalents,  and these can be used instead.  If
  243. you want the ability to change other options after CMDEDIT is loaded, don't put
  244. it in high memory.
  245.  
  246. CMDEDIT can sometimes upset the behaviour of programs which have a command
  247. input mode in which DOS editing keys,  and therefore CMDEDIT,  are still
  248. active.  I have seen such a program which takes one or two letter commands,
  249. and normally won't let you type any more.  CMDEDIT does let you type more, but
  250. then gives a "line too long" error.  This could potentially corrupt the display
  251. of a program not expecting it.  If this occurs,  use the /z toggle to disable
  252. CMDEDIT before starting your program.
  253.  
  254. WINDOWS 3.0:
  255.    If loaded prior to starting Windows,  CMDEDIT becomes unstable when running
  256. more than one DOS session.  This can sometimes result in Windows terminating a
  257. DOS session with a system integrity violation message as soon as a key is
  258. struck!  There is a work around to this bug,  the trick being to un-install
  259. CMDEDIT prior to loading Windows,  and then install it when you open each DOS
  260. shell.  This can be done from batch files as follows:
  261.  
  262. First,  start Windows with a batch file similar to the example below (perhaps
  263. called WIN.BAT):
  264.  
  265.      @echo off
  266.      cmdedit /u
  267.      c:\windows\win %1 %2 %3 %4 %5 %6 %7 %8 %9
  268.      cmdedit
  269.  
  270. This batch file assumes CMDEDIT was the last TSR loaded into conventional
  271. memory.  Now when you open a DOS session do not just load COMMAND.COM.
  272. Instead change the properties of your DOS icon to run the following batch file
  273. (I call this winauto.bat):
  274.  
  275.      @echo off
  276.      cmdedit /n
  277.      c:\command /e:1024
  278.  
  279. You can customise this as you please.  I actually call a batch file to start
  280. CMDEDIT with a number of switches and an initialisation file.  The /n switch
  281. is used here because I have found that on some occasions when closing a DOS
  282. session and immediately opening another,  CMDEDIT incorrectly reports that it
  283. is already installed.  You should however read the notes regarding /n before
  284. using this switch.
  285.      The last line of WINAUTO.BAT prevents the session terminating and
  286. returning to the program manager at the end of the batch file (the /e:1024 is
  287. simply my preferred environment size).  Note that in WINAOUTO.BAT it is quite
  288. OK to load cmdedit into high memory using DOS 5 or QEMM or some other loadhi
  289. utility (assuming you will not be changing the CMDEDIT installed options in
  290. the DOS session).  You must not load CMDEDIT into high memory before starting
  291. Windows,  however,  since then it cannot be un-installed.
  292.      As an aside,  notice that the procedure documented above can be extended
  293. to include disabling/enabling if a DOS screen saver if you use one.  You
  294. should not have a DOS screen save running prior to starting Windows,  but it
  295. is fine to start one in a DOS session (so long as the session does not run in
  296. the background).
  297.