home *** CD-ROM | disk | FTP | other *** search
- Living with DOS: PCED Command Editor
- by Barry Simon
-
- Copyright (c) 1986, Capital PC User Group Inc.
- This material may be republished only for internal use
- by other not-for-profit user groups.
-
- Additional material copyright (c) 1986, Barry Simon
-
- Posted on Compuserve with permission of CPCUG. May not be
- reproduced without including the above copyright notice.
-
- Published in the February 1986 issue of the Capital PC Monitor.
-
-
- INTRODUCTION
-
- This is the third article in a series on how to better cope
- with DOS by fully exploiting its capabilities and those of
- several software tools. In this month's article, I discuss
- PCED, the commercial version of CED, the Command EDitor authored
- by Chris Dunford. As you may recall from my review in the
- January Monitor, CED is a program which I find the most useful of
- all my utilities. Both the public domain version of CED and PCED
- provide four basic services:
-
- o A command line editor which is much closer to that provided
- by a good word processor than the strange editing modes
- provided by DOS.
-
- o A command stack which allows you to recall and reissue, with
- or without editing, DOS commands which you previously made.
-
- o A parameter recall feature that allows you to execute a
- program without having to reenter the required parameters.
-
- o A macro facility called synonyms that allows you to issue
- series of commands by issuing a shorthand name.
-
- As indicated in my earlier review, both CED and PCED are loaded
- into memory where they permanently sit between the user and DOS.
-
- While the original CED program remains in the public domain,
- numerous enhancements have been made and incorporated into the
- commercial version, PCED. In fact, all of the facilities
- originally provided by CED have been improved upon and enhanced
- in the commercial version.
-
- For the past few months, I have been using a beta test version of
- PCED and this article will discuss its features. I must
- emphasize that what I am reviewing is a beta test version and not
- the final released product.
-
-
- FEATURES
-
- Command Line Editor
-
- A new feature has been added to the command line editor: in CED,
- <Ctrl-End> erases to the end of the line; in PCED, <Ctrl-Home>,
- which erases from the start of the line to the cursor, is now
- available. The only editing feature which I miss is a key to
- transpose two letters which would be useful for poor typists like
- me.
-
- Because the DOS editing keys are not needed for DOS commands,
- they are disabled in CED. However, this causes a problem when
- using EDLIN because the F3 key is used to partially retype a
- line. In PCED, you get the F3 key back. Of course, EDLIN is
- such a poor editor that you might view it as a virtue of CED that
- it makes it more difficult to use.
-
-
- Improved Stacking
-
- The command stack has been improved in several ways. Since you
- wouldn't want to have to run through a long list to find the
- command you want to reissue, it is important that the stack not
- be filled up with commands you don't need. In PCED, the
- individual commands in a multiple command synonym are issued to
- DOS and appear on the screen, but only the original synonym is
- added to the stack.
-
- The nicest new feature of the stack is "prestacking". As in
- CED, hitting <Esc> blanks the command line but in PCED, hitting
- <Ctrl-K> blanks the command line and places it in the stack.
- That way, if you remember most of a long command but then realize
- you forgot the file name, you can prestack the command, call up a
- directory, and then recall the unfinished command.
-
-
- Better Synonym Processing
-
- The first command in a multiple command synonym can itself be a
- synonym; in CED only the later ones can't be synonyms. You can
- define several synonyms in a single line; with CED, I had two
- different synonyms, namely "gtbat" and "gtbatfiles" to mean
- "C:&cd\bin\batfiles". Now putting "syn gtbat*file ..." in my
- CED configuration file defines five synonyms including the two
- that I used to have. The letters after the "*" are optional when
- issuing the synonym.
-
- With PCED, you can call up a synonym, say "foo", by typing "ced
- edit syn foo" on the command line, edit it and make the edited
- line the new meaning of foo by just pressing <Enter>. I use this
- so often that I've made "edit" a synonym for "ced edit syn".
- PCED has a PACK command to remove redundant definitions from the
- synonym stack and a SAVE command to save all the current synonyms
- in a configuration file for loading with PCED in future sessions.
-
- You can now issue internal commands to CED from a BATch file. While
- you can't directly issue synonyms from a BATch file, a utility,
- XCED, is provided in the PCED package. The XCED utility allows
- you to call synonyms from a BATch file by installing a temporary
- new shell of DOS.
-
-
- User Installed Commands
-
- In CED, it is possible to install various user defined commands
- as part of CED which would act like DOS internal commands.
- Unless you have considerable programming experience, it is
- doubtful whether you would ever take advantage of this feature.
- To make this process easier, PCED includes several supplemental
- programs to install additional commands, including one that
- changes file attributes, one that allows you to call up SIDEKICK,
- and an enhanced directory command.
-
-
- Accessing the Environment
-
- For me, the two most powerful new features of PCED allow you to
- access the environment and various predefined variables. The
- environment is an area of memory set aside by DOS for storing
- information that it or other programs need. You can place
- information into the environment with the SET command so that
- typing
-
- set a=abcd
-
- at the DOS command line will add the variable a to the
- environment with a value of "abcd". PCED lets you access such
- variables in synonyms by placing the variable within %-signs.
- Thus, if you have the string %a% inside a synonym and you execute
- the above command, the string would get replaced by the value
- abcd. You would probably use this feature primarily with two of
- the three variables that DOS saves in the environment: your
- prompt, and your path. Here is a pair of synonyms which
- illustrate this feature:
-
- syn saveprmt set pr=%prompt%
- syn recallprmt prompt=%pr%&set pr=
-
- The first saves the current value of your prompt in a dummy
- environmental variable and the second recalls it. Thus,
- since one program UTIL that I use tends to crash if it is loaded
- with my fancy prompt installed, I call it up with the synonym
-
- syn u saveprmt&prompt= &util&recallprmt
-
-
- Predefined Variables
-
- Even more useful are several predefined variables whose default
- names are &m, &n, &p, and &c. However, since I already use the &
- as my chain character in CED, I changed the & to # and I'll use
- that in my illustrations. [Remember if you elect to follow my
- conventions, you must include the lines
-
- vc #
- cc &
-
- in your configuration file. The first one changes the predefined
- variable character from & to #; the second one changes the chain
- character from # to &.]
-
- Some of these predefined variables return the following:
-
- #m = the month in MM form
- #d = the day in DD form
- #n = the current drive without a :, e.g. A or B or C
- #p = the current directory in the form C:\bin\batfiles
- #c = the current directory in the form C:\bin\batfiles\
-
- The difference between "#p\" and "#c" is that for the root
- directory, the first returns "\\" and the second only "\".
-
- Here is a typical example of how to use these variables. I
- download my electronic mail with a BATch file that, in
- particular, puts it into a file called temp.imp. I like to keep
- the mail on disk in a file with the date of receipt. Thus I
- include the line
-
- xced ren temp.imp mail#m#d
-
- The xced is there to allow me to invoke ced from the BATch file.
- Mail that I capture on December 25, winds up in a file called
- mail1225.
-
-
- Examples of Synonyms Using #n, #p and #c
-
- While all predefined variables are useful, #n, #p and #c are
- especially so since the replacements take place before any
- commands are processed. Thus the synonym:
-
- syn t cd NEWDIR&MY PROG&cd #p
-
- when processed will change to the new directory, run MY PROG and
- then return to the directory where the original command "t" was
- issued.
-
- Here are some other examples of synonyms which make use of these
- powerful features of PCED. DOS 3.1 includes a program called
- SUBST that lets you assign a drive name to a directory. This is
- useful if you have software which does not support path names but
- supports multiple drives. The syntax is
-
- subst G: C:\bin\batfiles
-
- After issuing this command, any request to G: will call on the
- batfiles directory. It is important that you type in the full
- name of the directory you wish to assign to G, even if it is the
- current directory. Thus, I have two synonyms
-
- syn csub subst %1: #p
- syn rsub subst %1:/d
-
- so that "csub G" sets G to the current directory and "rsub G"
- removes that assignment.
-
- An example of a program that does not support path names is my
- preferred spelling checker WORDPROOF. Thus, I use the synonym
-
- syn wp subst G: #p>wp& wp G:%1n:&cd #p&subst G:/d
-
- which, when I enter wp filename, does the following:
-
- subst G: #p - makes the current directory G:
- gtwp - changes directory to the one that has the
- WORDPROOF program and the various
- dictionaries, etc. it will look for
- wp G:%1 - applies WORDPROOF to the file "filename" in the
- original directory that the command was
- issued; the space between & and wp is
- critical; without it, wp would be treated as a
- synonym and an infinite repeating loop would
- result!
- #n:&cd #p - returns to the original directory even if it is
- on a different drive from the WORDPROOF
- directory. Note that #n does not return a :
- so you must add it.
- subst G:/d - tidies up by removing the substitution. If you
- didn't, when you later tried using the wp
- synonym in some other directory, you would get
- into trouble.
-
- By the way, if you don't have DOS 3.1, here is a synonym which
- is almost as good (as long as you don't use it from the wp
- directory!):
-
- syn wp gtwp© #c%1& wp %1© %1 #p&erase %1n:&cd #p
-
- If you analyze what happens to a synonym like this when you are
- in the root directory, as opposed to any other directory, you
- will understand why you need both #c and #p.
-
-
- SUMMARY
-
- In summary, the enhanced features of PCED make a very useful
- product even more useful. It is a program which the serious PC
- user should definitely consider.
-
- PCED is available directly from the distributor:
-
- Cove Software Group
- P.O. Box 1072
- Columbia, MD 21044
- (301) 992-9371
-
- The suggested introductory retail price is $35, plus $2.50 for
- shipping and handling.
-
-
- ADDITIONAL MATERIAL
-
- Since the introduction of PCED, Dunford has added a number of
- additional user installed commands all available on the IBMNET of
- Compuserve. These include:
-
- o HS (Hindsight), a program that gives screen scroll recall of
- screens produced at the DOS level.
-
- o ALARM, a simple, small but useful alarm program. Alarms
- must be set at the DOS level but will go off in any program.
-
- o RAW, a program to turn RAW mode on
-
- as well as the KICK, CDIR, SEND and ATTR programs supplied with
- the original program.