The magazine of the Melbourne PC User Group
Beginners' Bytes: Part 13
Ron Wilby
|
 |
Thanks to our Editor's largess (large S or small s he's still Peter S to me), we had lots of
Beginners pages last month. Don't complain if you get less this time, I can't always keep awake after 2 am. Did you find last month's
Beginners' Bytes heavy going? Ok, so did I, but you really should print out the data on your disk drives. Do it
now.
Ron's Report
What's happened to me this month? A fun photography session with Gary Taig, Tessa, and Dave Mitchell. Terrific, when's the next one, Gary?
People often ask me if I know a program that will improve typing speed. Yes, I do. Here it is and it works!
Ron's recipe for improving your typing speed
- Only moderate quantities of alcoholic booze.
- A wife ailing and in bed.
- PC Update deadline is tomorrow.
Quite a lot of computer books arrive on my desk for various reasons. Sometimes I even get a laugh, like this extract from the chapter called Atrocious Acronyms:
ROM
Stands for: Read-only Memory
Pronunciation: Rahm (rhymes with bomb).
DiskContent
Two weeks ago someone asked me if I owned Lotus 1-2-3 Release 2.2. Searching the cupboards, I discovered a genuine, legal copy: disks, manual, the lot. I'd always been meaning to install it-next week of course-and the years have rolled by. Unusually for me, I hadn't even made working copies of the 360 kB floppies.
Time to use this, I thought, at least the colours may be better, and it's got that interesting
Allways add-in too. Better copy the disks. Failure at the first fence! My attempt to copy Disk 1, the system disk, caused DISKCOPY to report unrecoverable read error Side 0 track 39. Ho, I thought, SCANDISK is supposed to fix these problems, so I called it up to do just that. After I'd followed instructions, SCANDISK said it had done its job and all was now well. Once more DISKCOPY reported unrecoverable read error Side 0 Track 39. What now? From the same dusty cupboard as the 1-2-3 Rel. 2.2, my now outdated PC Tools, version 7.1. It includes
DISKFIX, which - quoting from the Manual-thoroughly scans a disk, searching for damaged data and repairing the data in many cases. Yes, you're right again, mine wasn't one of those cases. I duly did as I was told and
DISKFIX reported that all was now well. Once more DISKCOPY's answer was unrecoverable read error Side 0 Track 39. So two weeks ago, I packed up the offending disk and returned it to Lotus, with a letter asking for a replacement disk or further guidance on what to do next. Well, Lotus responded rapidly with suitable information and a contact phone number. Problem solved.
Around the Traps
Did you hear about the top-selling model of inkjet printer that is commonly a grey market import? This enables selling $30 or more below the going price for proper versions. What's the grey market? When the local agent or office of the manufacturer is bypassed. You save on the initial purchase, but if anything goes wrong, there's no backup from the Australian arm of the company. So, choose your dealer carefully. It may be cheaper to pay more. Also there are the usual tricks being played in this highly competitive area, such as the advertised price not including some essential accessory. Who wants an inkjet with no ink, even if it is $40 cheaper?
Funny of The Month
` ... though, being a Windows application, you'll always be computing through a condom." Ray Beatty,
PC Update, September 1994.
Ron At The RIPSIG
Recently I helped out Sam Brown at the Retired Persons Friday morning SIG. He asked me to talk about batch files, so I'll pass on some extracts from my notes for the benefit of those who weren't there.
Writing batch files needs a text editor that must produce an unformatted or ASCII file. You can use your word processor, but the DOS Editor is the best if you have DOS 5 or 6. If you don't have at least version 5, you are getting pretty outdated, aren't you? But you may have Norton or PC Tools utilities that have text editors.
Start the DOS Editor by typing EDIT at the prompt or by selecting Editor from your shell menu.
If you aren't using the Editor, check for formatting this way. Get to the DOS prompt and tell DOS to TYPE
[filename]. If you can read what's on screen, it's not formatted. Formatted word processor output is gibberish when displayed by the TYPE command.
Batch processing is the use of batch files to carry out a series of often-repeated tasks without having to type all the commands every time.
A batch file is a simple ASCII or plain text file containing a series of DOS commands. You give it a DOS filename with the extension, BAT, and the commands will be executed successively by DOS.
A Batch File Example
The file DIRALLBAT contains
DIR A:
DIR B:
DIR C:
Three separate commands, each one must be on a separate line. Don't add any commas or punctuation. To run this file type: DIRALL at the DOS prompt (no need to type the .BAT extension). DOS will carry out the three commands one after the other and the directories of the three disks will be displayed.
You can have hundreds of commands if required. Go and have a glass while DOS is doing all the work.
There are some DOS subcommands specially for batch file creation. Here, I'll only use three of them. They are ECHO, PAUSE and REM. The REM command, put at the beginning of a line in your batch file , causes DOS to ignore the line. REM is used so the writer of the file can include information, like who wrote it
and what it does. Use REM at the beginning of a line to make DOS (temporarily) disregard the command.
Suitable Filenames
In carrying out your commands DOS looks first for internal commands, like DIR or COPY, then external commands, like FORMAT. If you type FORMAT, DOS looks for
FORMAT.COM, then FORMAT.EXE. A file named FORMAT.BAT would only be executed if
FORMAT.COM and FORMAT.EXE are not found. So avoid names for your files that are associated with DOS commands. You can force the execution of a batch file by giving the full path, e.g. C:\BATCH\FORMAT.BAT.
Creating a Batch File
Here is a batch file, called COPPY.BAT. Why the double P? Typing the command COPPY will copy all the files from one disk to another. You can't use DISKCOPY because the drives A: and B: are different in capacity.
@ECHO OFF
ECHO Insert Target Disk
ECHO inDrive A:
ECHO Insert Source Disk
ECHO in Drive B: then
PAUSE
COPY B:*.* A:
ECHO Copy Completed |
What's it all do? By default, with ECHO on, DOS displays each command before
executing it. The @ECHO OFF line tells DOS not to do that. The next two lines are examples of how the ECHO command is used to display an instruction (or any line of text).
PAUSE is the other batch file command. It causes the execution to suspend and displays:
Press any key to continue
Unfortunately, any key won't do! The message should read any character key. Shift keys (including Alt and Ctrl) don't work here.
The next line does all the work of copying. The last line tells you it's all done.
If you often copy disks from your 5.25-inch drive to your 3.5-inch drive, that batch file will save you a lot of work. Look at your own computing. What tedious and repetitive task can you automate with a batch file?
Batch File Parameters
Consider the command
COPY FORMAT.COM B: /V
FORMAT.COM, B:, and /V are all parameters controlling some aspect of the COPY command. In a batch file you specify a replaceable parameter by a number (1- 9) preceded by a % sign. Those are called variable markers. If you create a batch file called SCRUB.BAT that contains:
ECHO ON
this line is see what's happening
ERASE %1
ERASE %2
ERASE %3 |
and you type a command at the prompt, like this:
|
SCRUB C:\DOGS A:JUNK.MUK
C:\PUPS\MONGRELS |
then DOS replaces %1 with CADOGS, %2 with A:JUNK.MUK and %3 with the file CAPUPS\MONGRELS.
You can call this batch file SCRUB.BAT (not DEL or ERASE or DELETE) and it will erase the three groups. Later, you can substitute other items for those three and use your batch file again. You just have to think about the tasks you need to do and use your imagination to write batch files to do them. For example, I use a batch file to start each of my main application programs. The batch file is hidden behind my menus, but it's there. Usually I want to change directory, then start up one or two programs together; for example, word processor plus Grammatik.
There are some other batch file commands: GOTO, CLS, IF and more. And there are many things you can do with them. Too many for this month. Be with you in the next issue ....
Reprinted from the October 1994 issue of PC Update, the magazine of Melbourne PC User Group, Australia
|