-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

SOLUTIONS Contents:

   []  Spiffing up Batch Files With Sound
   []  Multiple Wildcards With DIR
   []  Windows Users: Keep the DOS Line Open
   []  Random Hints
          <> Housekeeping Simplified: A DIR of your DIRs
          <> Giving your mouse a bath
          <> Take out the trash (and get it back!)
          <> To do or not to do -- an easy way to use Windows to keep
                track of your to-dos

Entire contents copyright 1994 by Falsoft, Inc.

PCM -- The Premier Personal Computer Magazine is intended for the private 
use and pleasure of its subscribers, and reproduction by any means is 
prohibited.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Spiffing Up Batch Files With Sound
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Boring batch files got you down? Add some sound! There's no "beep" 
command for DOS, but you can generate a beep in an ECHO statement by 
holding down the ALT key and (making the sure the NUM LOCK light is on) 
typing 007 on the numeric keypad. Try typing in and running this batch 
file -- remember to press ENTER after every line. (That ^G at the end of 
the ECHO command is the beep; again, you generate it by holding down ALT 
and pressing 007.)

C:\>COPY CON BEEPTEST.BAT
@ECHO OFF
ECHO GONNA BEEP NOW^G
CTRL-Z

Now type BEEPTEST and listen. Cool, huh? Note that when you display the 
BEEPTEST.BAT file using the DOS TYPE command, you can't see the beep 
anymore (the ^G is gone), but you can sure hear it.

   If you'd like to add beeps to existing batch files, use the EDIT 
program that comes with DOS 5 and 6. At the end of the ECHO line in which 
you want to add sound, press CTRL-P to go into EDIT's "Insert Special 
Character" mode, then press ALT-007. In EDIT you see the beep as a bullet 
character, like so:

ECHO Delete these files? Press CTRL-C to abort
PAUSE

   Beeps come in handy when batch files are involved in potentially 
dangerous activities such as deleting files. A well-placed beep just might 
prevent unfortunate accidents.


Sound Fun With the Norton Utilities

   If you have Norton Utilities' Batch Enhancer (BE) in your path, you 
don't have to bother with the ALT-key combinations to generate a beep: 
just insert the command BE BEEP in your batch file.

   Want to get fancy? You can create all sorts of musical beeps using the 
BE BEEP switches shown in Figure 1. The Duration and Wait values are in 
18ths of a second. So the command BE BEEP /F880 /R2 /D18 /W6 would play an 
'A' note (/F880) twice (/R2) over a period of a second (/D18), and the 
second beep occurs after a one-third second wait (/W6; 6/18 = 1/3). As 
another example, the following command lines generate a short batch file 
you can execute to play a simple fanfare:

COPY CON FANFARE.BAT
BE BEEP /F262 /D5
BE BEEP /F262 /D2 /R2 /W1
BE BEEP /F349 /D15
CTRL-Z

    _______________________________________________________________
   |                                                               |
   |  /Fx   x = frequency of notes to play                         |
   |  /Rx   x = number of times to repeat note                     |
   |  /Dx   x = duration of note(s) in 1/18ths of a second         |
   |  /Wx   x = time to wait between notes in 1/18ths of a second  |
   |                                                               |
   |---------------------------------------------------------------|
   |                 Figure 1: BE BEEP Switches                    |
   |_______________________________________________________________|


   See Figure 2 for some neat BE BEEP tunes we've assembled into batch 
files for you Norton users. Try 'em out. If you like them, just cut and 
paste their statements into your own batch files.

    ________________________________
   |                                |
   |  COPY CON ZARATHUS.BAT         |
   |  @ECHO OFF                     |
   |  BE BEEP /F262 /D18            |
   |  BE BEEP /F392 /D18            |
   |  BE BEEP /F523 /D40            |
   |  BE BEEP /F659 /D1             |
   |  BE BEEP /F623 /D18            |
   |  CTRL-Z                        |
   |                                |
   |  COPY CON TWINKLE.BAT          |
   |  @ECHO OFF                     |
   |  BE BEEP /F523 /D2 /R2         |
   |  BE BEEP /F784 /D2 /R2         |
   |  BE BEEP /F880 /D2 /R2         |
   |  BE BEEP /F784 /D6             |
   |  CTRL-Z                        |
   |                                |
   |  COPY CON THE5TH.BAT           |
   |  @ECHO OFF                     |
   |  BE BEEP /F330 /D1 /R3         |
   |  BE BEEP /F262 /D24            |
   |  BE BEEP /F294 /D1 /R3         |
   |  BE BEEP /F247 /D24            |
   |  CTRL-Z                        |
   |                                |
   |--------------------------------|
   | Figure 2: Sample BE BEEP Tunes |
   |________________________________|


   Figure 3 provides a frequency-to-musical note relationship chart; you 
may need it when putting together your own musical beeps. You can also use 
these frequencies for SOUND statements in GW-BASIC and QBASIC.

   You can make different beeps means different things in your batch 
files. For example, insert high-pitched or up-scaling beeps to let you 
know when the batch file has finished its task, and down-scaling beeps to 
signify error conditions.

    _______________________________________________________________
   |                                                               | 
   |  NOTE FREQUENCIES                                             |
   |                                                               |
   |         Octave 1   Octave 2   Octave 3   Octave 4   Octave 5  |
   |                                                               |
   |  C        262        523*       1047       2093       4186    |
   |  C#       278        555        1111       2221       4442    |
   |  D        294        587        1175       2349       4699    |
   |  D#       312        623        1247       2493       4986    |
   |  E        330        659        1319       2637       5274    |
   |  F        349        698        1397       2794       5588    |
   |  F#       371        741        1482       2965       5930    |
   |  G        392        784        1568       3136       6272    |
   |  G#       416        832        1664       3328       6656    |
   |  A        440        880        1760       3520       7040    |
   |  A#       467        934        1868       3736       7471    |
   |  B        494        988        1976       3951       7902    |
   |                                                               |
   |   * Middle C                                                  |
   |                                                               |
   |---------------------------------------------------------------
   |                Figure 3: Musical Frequencies                  |
   |_______________________________________________________________|

-=--------------        -=*=-     -=*=-     -=*=-        --------------=-

Multiple Wildcards With DIR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   There are times when we want to display a directory listing that 
includes only specified files, but the files we want to see can't be 
selected using a single wildcard. For example, suppose you forget the name 
of a command, and you want to display a list of all executable files 
(*.BAT, *.COM and *.EXE) in the current directory to jog your memory. With 
a simple batch file, DOS lets you do this. The following batch file 
accomplishes just the trick (and it sure beats typing DIR *.BAT, DIR *.COM 
and DIR *.EXE consecutively):

@ECHO OFF
:START
IF "%1"=="" GOTO END
DIR %1
SHIFT
GOTOSTART
:END

   Enter the batch file using COPY CON of a text editor, saving it as 
D.BAT or any other name you think appropriate. To use it, just type D 
followed by any wildcard specifications (separate multiple parameters with 
spaces) you desire and press ENTER. For example, the command

      D *.BAT *.COM *.EXE

shows all the executable files in the current directory.

   One drawback to D.BAT is that you get separate directory listings for 
each parameter supplied. If you are interested only in the filenames 
without the header and footer information normally produced by DIR, change 
DIR %1 to DIR /B %1 in the batch file. You can also use DIR /B /W %1 for a 
list of only the filenames in multiple columns.

   If you use NDOS and 4DOS, you can use a very short alias to accomplish 
the same task as D.BAT:

      ALIAS D=FOR %%I IN (%%1&) DO DIR /K /M %%1

This version lists one file per line without the header and footer 
information, but also prints the size, date and time of each file.

-=--------------        -=*=-     -=*=-     -=*=-        --------------=-

Windows Users: Keep the DOS Line Open
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Not everyone agrees about this, but sometimes an easy-to-use graphical 
interface really doesn't make things so easy. Take Windows' File Manager, 
for example. Yes, it lets you copy a file from your hard drive to your 
floppy drive by dragging and dropping.

   But first you have to load File Manager (which means opening the Main 
group), then you have to wait while it reads the disk, then you have to 
click to get to the right directory, THEN you initiate the copy.

   Sure it's easy, but is it faster or easier than typing this at the DOS 
prompt?


      CD \MYDIR
      COPY MYFILE.DOC A:\

   Nope, not by a long shot. That's why we are recommending to you 
Windows-using power users to always keep a DOS session active. That way, 
whenever you need to perform a file operation in a hurry, all you have to 
do is use the Task Manager to get to a full-screen DOS prompt, copy the 
file or whatever, then use the Task Manager to get back to your Windows 
program. It's easy and fast: here's how to do it:

   1) Start a DOS session. In Windows, click on any icon that says MS-DOS 
or MS-DOS Prompt. Now you're at a DOS prompt, just as you were before you 
loaded Windows, but Windows is still there -- you just can't see it.

   2) Return to Windows without exiting DOS. Press CTRL-ESC to call up the 
Task List and click on the name of your Windows program to return to it. 
Your DOS session is still there even if it's not visible.

   3) Use the Task List to go back and forth. CTRL-ESC calls up the Task 
List for "teleporting" among your open programs whether you're in a 
Windows application or a DOS session. CTRL-ESC is quick, but there's an 
even faster way: ALT-TAB. Hold down the ALT key and keep tapping the TAB 
key until the name of the program you want comes up, then let up on ALT -- 
there you are!

   4) Don't forget to "EXIT" the last time. Windows will let you exit its 
system even if Windows applications are open, but it won't let you exit 
while DOS sessions are open. So, before you attempt to exit Windows, ALT-
TAB back to your DOS screen and enter EXIT at the prompt. Now you can exit 
Windows normally.


When to Use File Manager

   Even power users find good uses for File Manager now and then. It 
addresses DOS's weaknesses, namely that DOS works with one file at a time 
-- or all files at a time. If you need to work with only some of a 
directory's files, and those files do not share a common extension or 
other naming characteristic, DOS can turn simple file management into 
drudgery.

   File Manager excels when you need to deal with some files. For example, 
it lets you copy ranges of files: select a file from the directory list, 
hold down a SHIFT key, and click on another file further down the list. 
Notice that all the files in between are selected too. You've selected a 
range of files that can be copied, erased, or whatever.

   The File Manager is also good at selecting files that don't happen to 
fall within a range. Hold down the CTRL key while you click and you can 
select files from all over the directory list.

   File Manager has a built-in MOVE command, which DOS doesn't (though a 
MOVE command has finally been added in DOS 6.x). To "move" a file in DOSes 
up to version 5.0, you must copy it and erase the original. File Manager 
makes moving as easy as selecting your file(s), then pointing at a 
destination directory on your tree display.

   File Manager lets you rename directories. Just try to do that in DOS. 
You can't!

   File Manager also has unarguably better views. You can see every 
possible subdirectory -- or you can collapse the "branches" of the tree 
display to view only the main directories. The biggest plus is, you can 
scroll up and down the tree. In DOS, you can't scroll back to look at data 
that has scrolled up and off the screen. The same holds true with 
filenames in directory displays.

   If your file-management needs require it, you might also consider 
always having a copy of File Manager open and ready for business.


Tips

   []  If you have 4DOS or NDOS, use that instead of a regular 
       MS-DOS session for file-management tasks. After all, 4DOS and 
       NDOS have more power-user features, such as a built-in MOVE 
       and SELECT commands.

   []  You can run a DOS session in a Windows window, not just as a 
       full screen. Try it: press ALT-ENTER to toggle between full-screen
       DOS mode (the "normal" mode) and a Windows window. If you can 
       see the DOS window, all you have to do to activate it is click 
       on it with your mouse pointer -- Task Manager not required.

       If you'd like to see your Windows applications and the DOS window
       at the same time, resize all windows so that it's possible. 
       That way, you can click to move back and forth. We found 
       it interesting to resize the DOS window so that it was no more 
       than three or four lines tall -- more than big enough to hold a 
       DOS command but small enough to stay out of the way. It's 
       like having a DOS-prompt toolbar.

   []  You can have many DOS sessions open at one time -- just keep going
       back to Windows' Program Manager and clicking on the MS-DOS icon.
       Remember, you can run any DOS application from the DOS prompt. So
       you might decide to open three DOS sessions: one for WordPerfect 
       5.1, one for Lotus 1-2-3 and another one for quickly copying files.
       Although if you consistently use Windows to run several DOS 
       programs at the same time, you might consider giving each program
       its own icon in the Program Manager.

   []  If you do run more than one DOS session from Windows, 
       you've probably noticed that they all share the same name in 
       the Task List -- which is more than a little confusing. 
       So you might consider cloning the MS-DOS or MS-DOS Prompt 
       icon -- giving each clone a different name (DOS 1, DOS 2, 
       etc.) -- and using clones instead of the same icon.

       To clone the MS-DOS Prompt icon, click on it once to select 
       it, click on the Program Manager's File menu and select the Copy
       option. In the Copy Program Item dialog box, select the 
       destination group, click OK and you have a cloned icon! To change 
       the new icon's name, click to select it and click on the File menu 
       again, this time selecting the Properties option. In the 
       Description field of the dialog box, type the name and click OK.

   []  Windows 3.1 comes with a group called StartUp. Since any program in 
       this group is automatically loaded on Windows bootup, you might 
       consider copying the icons for the MS-DOS prompt and File Manager 
       into this group. Then they'd always be available -- and you 
       wouldn't have to wait for them to load.

-=--------------        -=*=-     -=*=-     -=*=-        --------------=-

Random Hints
~~~~~~~~~~~~

              HOUSEKEEPING SIMPLIFIED: A DIR OF YOUR DIRs

   When you're moving through the directories on your hard drive, deleting 
unnecessary ones as you go, you really don't want to wade through a bunch 
of filenames to find the subdirectories. Of course you could redirect the 
output of DOS's TREE command to the printer, giving you a hard copy of 
your directory structure for reference (TREE>PRN). But that gets a little 
cumbersome at times. If you have DOS 5 or 6, you could also set the DIRCMD 
environment variable to put all subdirectory entries at the top of the 
listing when you enter DIR (we recommend you use something like SET 
DIRCMD=/OGNE anyway in your AUTOEXEC.BAT file anyway).

   If you don't have DOS 5 or 6 (with which you can simply enter DIR /AD), 
the best way we've seen to eliminate these problems, allowing you to see 
only the subdirectories in the current directory, is to do a DIR of the 
<DIR>s; pipe the output of DIR through the FIND filter, and tell FIND to 
look for the less-than (<) symbol, which is a part of all directory names. 
Just enter

      DIR | FIND "<"

   To get a little bit fancier, put this command in a batch file called 
DIRD in your BATCH directory. Add the @ECHO OFF statement at the 
beginning, and you'll have a handy little housekeeping tool.

   DOS 5/6 users can make this utility even better by taking advantage of 
DOSKEY. Just add the line

      DOSKEY DIRD=DIR /AD

to your AUTOEXEC.BAT file or a separate batch file that loads all of your 
DOSKEY definitions. Then whenever you enter DIRD, you'll get the output 
you need.

                                  -=*=-

                        GIVING YOUR MOUSE A BATH

   No matter how careful you are to keep your mouse's "cage" clean, it'll 
eventually need a bath. (You'll know this when the mouse cursor jerks 
around the screen when you move it.) Giving your mouse a bath is a lot 
easier than it may at first appear.

   To get started, disconnect the mouse from the computer, turn it over 
and remove the retaining plate. With the plate out of the way, the rubber 
ball inside will come out if you tip the mouse over. Scrub the ball 
thoroughly (but be gentle -- it is part of a mouse, you know), using water 
and some mild detergent, then rinse it well. Finally, set the ball aside 
to dry for several hours; it is important that it be completely dry before 
you reassemble the mouse.

   While the ball dries, remove loose dirt from inside the mouse by 
blowing into the cavity (a good set of lungs or a can of compressed air 
works well). Now use foam swabs and denatured alcohol to remove the gunk 
from the rollers inside the mouse. Sometimes a little extra work is needed 
to remove stubborn gunk. You can use your fingernail for this, but 
whatever you use, be careful to not scratch the roller -- that could make 
your mouse permanently jumpy. Make sure to remove any loose dirt after 
this step too.

   When the rubber ball is dry, make sure it hasn't attracted any lint. 
Then pop it back into place and replace the retaining plate.

   Finally, when you put your mouse back into operation, be forewarned 
that it will appear to be much faster. (It's amazing how a simple bath can 
be so invigorating.) Because you've gotten used to moving it through the 
muck, you'll have to go easy for a while.

                                  -=*=-

                           TAKE OUT THE TRASH

   Have you ever deleted a file only to realize (usually just after 
pressing ENTER) you've trashed the wrong file or that you really weren't 
finished with it? Yeah, you can UNERASE and UNDELETE, but you might also 
find that a computerized trash can -- one you could grab stuff back from 
before "dumping" <G> -- is pretty helpful at these times, and with DOS 5 
or 6, building a simple trash can is pretty easy.

   First create a new directory called TRASH from your root directory. 
Then use DOSKEY to create a macro replacement for the DEL command. Add the 
following line to AUTOEXEC.BAT (or other batch file you use to load DOSKEY 
macros):

      DOSKEY DEL=COPY $1 C:\TRASH $T DEL $1

   With this DOSKEY macro in effect, any time you enter DEL, DOS will copy 
the file(s) to the TRASH directory and delete it from its current 
location. (Inside the macro, the use of DEL calls DOS's internal DEL 
command rather than calling the DEL macro again.)

   To "dump" the trash can and get rid of the files for good, we use a 
short and simple batch file called EMPTY.BAT. Here's how to create it:


COPY CON EMPTY.BAT
@ECHO OFF
ECHO Y | DEL C:\TRASH

   Since DOSKEY macros don't work within batch files, the actual DOS DEL 
command is invoked, removing any files in C:\TRASH. And piping ECHO Y 
through DEL means you won't have to answer the "Are you sure?" prompt.

                                  -=*=-

                           TO DO, OR NOT TO DO

   If you're into to-do lists, you're probably already well organized and 
have a super PIM (personal information manager) to handle this chore. But 
if you're simply looking for a way to track a few daily tasks and 
reminders, you can use Windows without putting out any extra bucks.

   Open Windows' Notepad and type your first list (or just create a 
template, or model, of how you'd like the list to look). Now save the file 
as TODO.TXT, and exit Notepad. Back in Program Manager, click on File-New, 
the Program Item radio button, and OK. Call the new program item To Do, 
then use Browse to locate the TODO.TXT file (type TODO.TXT in the File 
Name box, then click on OK or press ENTER). Now click on Change Icon, type 
PROGMAN.EXE in place of NOTEPAD.EXE, and press ENTER. A new set of icons 
appears, from which you can select your preference (we like the little 
note paper with the thumbtack in it). Click OK twice, and the ToDo program 
item is added to the current window on your desktop.

   Whenever you double-click on the To Do item, Windows calls up Notepad 
with the TODO.TXT file in place. You can just review the list or change it 
as necessary and save the altered file.

-=------------=-     T-H-E   E-N-D   F-O-R   N-O-W     -=-------------=-

