home *** CD-ROM | disk | FTP | other *** search
- echo off
- rem xdemo_ad.bat - Demonstrate Advanced "DOS Extensions for Professionals".
- rem
- rem
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Welcome to "DOS Extensions for Professionals" ║
- echo ║ ║
- echo ║ An Advanced Demo ║
- echo ║ ║
- echo ╟─────────────────────────────────────────────────────────────────────────────╢
- echo ║ ║
- echo ║ This demo covers more complicated features of some "DOS Extensions for ║
- echo ║ Professionals" programs. ║
- echo ║ ║
- echo ║ Executing this batch file from a hard disk directory containing a copy of ║
- echo ║ the programs and files on the distribution disk will result in ║
- echo ║ significantly faster execution than a floppy-based demo because of the ║
- echo ║ superior performance of your hard drive during disk-intensive operations. ║
- echo ║ ║
- echo ║ For proper operation, the disk this demo executes from must have at least ║
- echo ║ 26,624 bytes free. If output is missing, check your disk for adequate ║
- echo ║ free space with the DIR or XDIR commands. ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ You must be running XDEMO_AD from your distribution disk or from a copy of ║
- echo ║ your distribution disk on your hard drive. ║
- echo ║ ║
- echo ║ If your current directory is NOT set to the distribution disk or to a copy ║
- echo ║ of the distribution disk on your hard drive, ║
- echo ║ ║
- echo ║ 1. "<CTRL> C" out of this program, ║
- echo ║ 2. change to the drive on which the distribution disk is mounted, and ║
- echo ║ 3. restart this program ║
- echo ║ ║
- echo ║ (for example) ║
- echo ║ Strike a key when ready . . . "<CTRL>C" ║
- echo ║ Terminate batch job (Y/N)? y ║
- echo ║ C: A: ║
- echo ║ A: xdemo ║
- echo ║ ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Making directory TEMP and copying files to it. ║
- echo ║ ║
- echo ║ ║
- echo ║ The programs demonstrated here are: ║
- echo ║ SPLIT - split files into parts ║
- echo ║ SUB - substitute characters in files ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- rem Free space in case diskette is filled.
- rem *** del x.dat >nul
- mkdir temp >nul
- copy rev22.old temp >nul
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Text from the last chapter of the last book of the Bible, the 1611 King ║
- echo ║ James Version, will be used to demonstrate several commands in "DOS ║
- echo ║ Extensions for Professionals". ║
- echo ║ ║
- echo ║ QUICKLY refresh your memory as the text scrolls by. Note that the text is ║
- echo ║ divided into 21 VERSES separated by blank lines. ║
- echo ║ ║
- echo ║ "TYPE REV22.OLD" (A DOS command.) ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- pause
- type rev22.old
- echo ───────────────────────────────────────────────────────────────────────────────
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Change to the \TEMP directory in order to demonstrate commands using write ║
- echo ║ operations. Use a copy of REV22.OLD as the source. ║
- echo ║ ║
- echo ║ SPLIT can divide files into "n" pieces, into pieces "n" lines long, at ║
- echo ║ predetermined lines, or at locations marked by user-chosen search strings. ║
- echo ║ ║
- echo ║ The first two examples of SPLITing files at fixed locations were ║
- echo ║ demonstrated in XDEMO. The more difficult example of SPLITTing a files at ║
- echo ║ contextually-defined locations will be demonstrated here. ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- cd temp
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ SPLIT rev22.old into 21 files, one for each verse. To do this, look for a ║
- echo ║ blank line preceding each verse (except the first), and instruct SPLIT to ║
- echo ║ make the break there. ║
- echo ║ ║
- echo ║ Because SPLIT doesn't recognize a simple blank line, pad all lines to ║
- echo ║ column 10 with blanks. Column 10 is shorter than normal lines which won't ║
- echo ║ be affected. Blank lines, however, will be lengthened to 10 characters. ║
- echo ║ The search, therefore, can be made on a string of up to 10 blanks. ║
- echo ║ ║
- echo ║ Review the Built-in Help for SUB /PAD ║
- echo ║ ║
- echo ║ SUB -HELP /PAD ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- pause
- cls
- ..\sub -help /pad
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Use SUB to pad the lines of REV22.OLD out to 10 characters. ║
- echo ║ ║
- echo ║ SUB REV22.OLD /PAD=10 ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- rem Save disk space with /nobak
- ..\sub rev22.old /pad=10 /nobak
- echo ───────────────────────────────────────────────────────────────────────────────
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Now SPLIT REV22.OLD before lines where there are 7 blanks. ║
- echo ║ ║
- echo ║ SPLIT REV22.OLD /BEFORE=" " ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- ..\split rev22.old /before=" "
- ..\xdir rev22
- echo ───────────────────────────────────────────────────────────────────────────────
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Using the DOS TYPE command, output several files to see if their verse ║
- echo ║ numbers match their file extension number. There are 21 verses. There are ║
- echo ║ 21 files. They should correspond perfectly. ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- echo on
- type rev22.003
- type rev22.016
- echo off
- echo ───────────────────────────────────────────────────────────────────────────────
- del rev22.* >nul
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Demonstrate SUB by creating a batch file which processes each non-directory ║
- echo ║ file found in the root directory against a ficticious CONVERT program ║
- echo ║ which requires as output the original file name with the extension ".TRS". ║
- echo ║ Each line should have the form ║
- echo ║ ║
- echo ║ CONVERT file.ext file.TRS ║
- echo ║ ║
- echo ║ Use XDIR to create the base file. ║
- echo ║ ║
- echo ║ "XDIR .. /NODIRECTORIES /COLUMN=1 /NOHEADING /NOFOOT > X.BAT" ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- ..\xdir ../nodirectories/column=1/noheading/nofoot > x.bat
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Initially X.BAT looks like this. ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- type x.bat
- echo ───────────────────────────────────────────────────────────────────────────────
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Use SUB to copy the file name to column 15. File names, remember, can be ║
- echo ║ of differing lengths but occupy at most columns 1 through 12. ║
- echo ║ ║
- echo ║ SUB X.BAT /COPY=1,12 /AT=15 ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- ..\sub x.bat /copy=1,12/at=15 >nul
- type x.bat
- echo ───────────────────────────────────────────────────────────────────────────────
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Search for the extension in the second file name and replace it with ".TRS".║
- echo ║ ║
- echo ║ The second file name's extension begins with "." and is located somewhere ║
- echo ║ in columns 15 through 27. The extension is at most 4 characters long and ║
- echo ║ must be replaced with the extension ".TRS" ║
- echo ║ ║
- echo ║ The "/FOR=" Command Modifier is the anchor for both /DELETE and /INSERT. ║
- echo ║ In this case, /FOR is constrained to look for its target text (".") in ║
- echo ║ the range limited by /FROM=15,27. If "." is not found in that range, no ║
- echo ║ substitution is made in that line. ║
- echo ║ ║
- echo ║ SUB X.BAT /FROM=15,27 /FOR="." /DELETE=4 /INSERT=".TRS" ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- ..\sub x.bat /from=15,27/for="."/delete=4/insert=".TRS" >nul
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ SUB X.BAT /FROM=15,27 /FOR="." /DELETE=4 /INSERT=".TRS" ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- type x.bat
- echo ───────────────────────────────────────────────────────────────────────────────
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ Finally, insert "CONVERT " at each line's beginning. ║
- echo ║ ║
- echo ║ SUB X.BAT /INSERT="CONVERT " ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- ..\sub x.bat /insert="CONVERT " >nul
- type x.bat
- echo ───────────────────────────────────────────────────────────────────────────────
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ This somewhat contrieved example illustrates the power of SUB. Calls this ║
- echo ║ complicated would, in practice, themselves be put into a batch file - a ║
- echo ║ batch file to create other batch files. ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝
- cd ..
- del temp\x.*
- rd temp
- rem *** copy /b split.exe+search.exe x.dat >nul
- echo off
- rem xdemo_as.bat - This portion of the xdemo_ad program is inserted as a
- rem reminder into the shareware version.
- pause
- cls
- echo ╔═════════════════════════════════════════════════════════════════════════════╗
- echo ║ ║
- echo ║ This is the Shareware Version of "DOS Extensions for Professionals". ║
- echo ║ ║
- echo ║ You are licensed to use this software for an evaluation period of THREE ║
- echo ║ WEEKS. After this period, you must either remove all copies of this ║
- echo ║ software from your computer system and refrain from all additional use, ║
- echo ║ or register your copy with ║
- echo ║ ║
- echo ║ Allison Software ║
- echo ║ 166 Shady Lane ║
- echo ║ Apollo, PA 15613 ║
- echo ║ USA ║
- echo ║ ║
- echo ║ When you register, you'll receive the latest Retail Version of "DOS ║
- echo ║ Extensions for Professionals", a printed instruction manual, and mail and ║
- echo ║ telephone product support as needed. ║
- echo ║ ║
- echo ║ Registration instructions are in the file REGISTER.DOC on the distribution ║
- echo ║ disk. ║
- echo ║ ║
- echo ╚═════════════════════════════════════════════════════════════════════════════╝