DOC 1.1 documentation file ----------------------------------------------------------------------- Please note - this is a plain ASCII text file but it contains multiple documents. You may find it most convenient to view or print this file using the DOC.EXE program supplied. ----------------------------------------------------------------------- Title1:PC DIRECT Title2:Hot! Utilities Copyright:(C)1993 Ziff-Davis UK Ltd @@Introduction Introduction PC DIRECT Hot! Utilities ------------------------------------------------------- Welcome! This collection contains twenty popular and useful utility programs selected from the PC Magazine library. A wide variety of tasks is covered by the programs so you'll find it helpful to read the summary below and to browse through this documentation to see which will be most useful to you. About the programs ------------------ The twenty utilities included are: 2FILE & 2FLOPPY Copy 'images' of floppy disks to and from hard disk files. An easy way to transmit floppies via modem, duplicate multiple floppies and even back-up or archive data. BAT2EXEC A compact, easy-to-use batch file compiler that will take a slow .BAT file and make a real .COM program version of it. This is a handy tool for those who use a lot of batch files or write long, complex ones. BATCHMAN Almost everything you've wanted to do in a batch file but couldn't in one small multi-function program, BATCHMAN puts 48 useful functions at your fingertips. CDX An alternative to the normal DOS CHDIR or CD command, CDX will find and change to directories without you having to type the full path. CHKFRAG This neat utility checks for file fragmentation (files being stored in several areas of a disk, which can slow down the system) so that you know if and when you need to run a defragmenting program. DIRMATCH Displays two directories side-by side so that you can easily see which files are in one or the other and which are in both. Includes facilities to copy and move files to ensure that both directories are fully up-to-date. FFF A full-featured file finding program that will quickly locate files in any sub-directory on one or more disk drives. FILECTRL A file viewer that automatically handles formats from many popular DOS applications, making it easy to browse through your disks. FREE A simple little program to report free, used and total disk space on one or more drives. Use it with FSIZE below. FSIZE A valuable utility for anyone who's ever copied a group of files and got an unexpected disk full error; FSIZE shows how much disk space files really take up, based on the DOS cluster size being used on a disk. HUGECALC (HC) A very simple calculator with one unusual aspect; HUGECALC works with numbers up to 254 digits long! INSTALL & Essential tools for anyone who uses REMOVE memory-resident programs alongside large applications, INSTALL and REMOVE let you safely load and unload memory-resident (TSR) type programs as and when you need to. KEY-FAKE Simulates a sequence of key-strokes so that you can run a small utility or skip over the opening screens when a large program starts. LITES Fun to watch and a real time-saver when you need it, LITES simulates an RS232 'breakout box', showing you the status of a communications port as it works. PRN2FILE A simple memory-resident program that will capture data sent to a printer in a disk file; ideal if you want to capture printer output for further processing or just an easy way of saving a print run for printing later or on a different machine altogether. PRUNE A directory tree manager that lets you easily copy, move, delete and rename sub-directories or whole sections of the sub-directory tree on a hard disk. SETUP2 One of those programs that almost everyone can make use of, SETUP2 lets you configure your printer, select typefaces, styles or paper trays and so forth. You can use it from the command line or create your own menu of functions that you can pop-up from within other programs. SLICE & Solving an age-old problem, SLICE SPLICE chops a large file into sections across multiple floppies. It then creates a matching SPLICE program that allows the file to be reassembled on another machine. SMOOTH Hardware smooth scrolling is a luxury display feature that's rarely seen on PCs. SMOOTH takes control of an EGA or VGA display to let you comfortably read through text files. SNIPPER A little memory-resident program that lets you capture part of the screen display and either print it, save it to disk or paste it into a file in another program... a useful tool for moving data between DOS programs. The PC Magazine Utility library ------------------------------- These programs are taken from the library of utility programs originally written for the US edition of PC Magazine, PC DIRECT's sister title. More information on these and the other programs in the library is available on-line in the ZiffNet forum on the CompuServe Information Service. Where do I go from here? ------------------------ For more information about installing and running these programs, see the 'Tech Notes' document. If you're reading this in the DOC documentation viewer provided, press the Left arrow key to go back to the document list on the left and then the down arrow key to highlight 'Tech Notes'. It is a good idea too to make sure that you read the instructions for each program fully before trying to use it. @@Tech Notes Technical Notes PC DIRECT Hot! Utilities ------------------------------------------------------- This document provides additional information on setting up and using these utilities and on using the documentation viewer program. Installing the programs ----------------------- To install these programs to a hard disk, use the install program provided (started by typing GO). Running the utilities --------------------- These utilities are all individual programs which should be started or loaded from the DOS prompt as needed by entering the relevant command (usually the program name followed by a space and any parameters that particular program needs). Read the documentation for a particular program before trying to use it. This will give a guide to the command format needed to use the program and, in most cases, a few examples to show you how it works. Please note that there is no overall menu or front- end for the utilities as this isn't really an appropriate way to use them. In general, the way to run a particular program is to change to the drive and directory where it is stored and then enter the relevant command. For example, if you want to run the DIRMATCH program, and you install these programs to a C:\HOTUTILS directory, you might enter: C: change to drive C CD \HOTUTILS change to the HOTUTILS directory DIRMATCH start DIRMATCH Putting the programs in your DOS command PATH --------------------------------------------- You can start DOS programs by either changing to the drive and directory they are in and then entering the relevant command or, if you have DOS 3.0 or later, giving the relevant drive and directory before the command name (e.g. enter C:\HOTUTILS\PRUNE to start PRUNE from a HOTUTILS directory on drive C). However, it is most convenient if you place the programs in your DOS command search path... a directory that is mentioned in your current PATH command. You can do this by either: * Adding the directory the program is in to your normal PATH command in AUTOEXEC.BAT. For example, if the PATH command in your AUTOEXEC.BAT file reads C:\DOS;C:\WINDOWS you might change it to read C:\DOS;C:\WINDOWS;C:\HOTUTILS You should be careful when making changes to AUTOEXEC.BAT not to disturb other commands already in it. See your DOS manual for full instructions. or * Copying those programs you use often to a directory already in your PATH command. Many PCs already have a directory called \BIN or \UTILS for small utility programs like these. For example, if you have a \BIN directory on drive C and use the HC program often, copy it across with a command like this: COPY C:\HOTUTILS\HC.EXE C:\BIN Loading programs from AUTOEXEC.BAT ---------------------------------- Some of these utilities are designed to be loaded or run whenever your PC is working by placing the relevant command in the AUTOEXEC.BAT startup file. Please bear in mind: * The program file must be available for AUTOEXEC.BAT to load it. If it is not in a directory already named in a PATH command earlier in AUTOEXEC.BAT, you must give the drive and directory where it is stored (e.g. C:\HOTUTILS\SNIPPER) or copy the file to the root directory of the hard disk. * The order in which resident programs are loaded can be significant. If there appears to be a conflict, try re-ordering the lines in AUTOEXEC.BAT. * Always keep a startup floppy to hand and a back-up copy of your AUTOEXEC.BAT file so that if problems arise you can restore things to normal. Using TSR (memory-resident) programs ------------------------------------ Some of these utilities are 'TSRs' or memory-resident programs. These load into memory when first started and remain there, either operating invisibly or waiting to be called up. TSR programs are very popular and those in this set are carefully written and fully tested. However, the design of DOS means that there is always a chance of conflict between different TSR programs or between a TSR and your main software. To avoid problems, please note: 1. You should carefully test any new TSR program on your system before using it while doing your normal work. 2. Each TSR uses up memory. If you load too many at once, your normal software may not be able to run. 3. If you discover a conflict, loading the TSRs in a different order may resolve it. 4. You can sometimes change the 'hotkey' used to call up a TSR to avoid a conflict with keys used by your other programs. Viewing and printing the documentation -------------------------------------- A simple on-disk documentation viewer and printer is provided in the program file DOC.EXE. The documents for this are stored in the file HOTUTIL.TXT. You can start DOC by changing to the disk and directory containing it and entering DOC. Running DOC ----------- DOC displays a list of available documents down the left side of the screen and shows the text of the currently selected document on the right. To select documents, use the up and down arrow keys to move through the list on the left. Typing the initial letters of a document name will jump directly to the next matching document. Once you've found the document you want, press TAB or the right arrow key to move to the text of the document on the right. The cursor keys (Home, End, Up, Down, PgUp, PgDn) will now move through the text. Press the left arrow or TAB key again to go back to select other documents. The DOC menu ------------ To call up DOC's menu, press the ESC key. DOC presents various options which you can select with the cursor and Return keys or by pressing one of the highlighted letters. The options will vary depending on your PC's configuration and the document files available. Pressing ESC a second time cancels the menu. Quitting DOC ------------ Choose the Quit option from the menu to leave the DOC program and return to DOS. Colour display off ------------------ Choose Colour display off from the menu to ask DOC to work in black-and-white. You may wish to do this if you're using a laptop with an LCD screen that doesn't show colours well or with some greyscale or CGA composite video monitors. This menu option does not appear on PCs that do not have a colour capability. Extended screen on ------------------ Choosing this menu option switches the display to 43 or 50 lines so that you can see more text without scrolling. You can go back to the normal display by choosing Extended screen off subsequently. This menu option is only available on EGA or VGA equipped PCs. If you have a Super VGA display card and a program to set extended text modes, such as 60 lines deep, you might like to try setting an appropriate mode before starting DOC... the program will operate correctly with many non-standard Super VGA formats. Fast screen on -------------- This menu option only appears on PCs fitted with CGA or equivalent displays. Normally the DOC program deliberately slows down on this type of display to prevent the screen flicker or 'snow' that some CGA displays can suffer from. If your system does not suffer from snow, choose 'Fast screen on' for a faster screen display. There's no harm in trying this option either way on your PC... snow does no harm and you might prefer to have a fast display that flickers to a slow one that doesn't. Print Document -------------- Choose this menu option to print the currently selected document. A menu appears from where you can make four print settings, choose Go to start printing or Cancel to return to viewing documents. You may need to alter the settings to suit your system before choosing Go as follows: 1. Output port This is the printer interface that DOC should print the document to. By pressing O you can step through the ports fitted to your computer. The default LPT1, the first parallel printer port, is correct for most PCs. DOC can work with a serial printer (COM1 or COM2) if you have one but you must make sure that the port is correctly set up (e.g. with a command such as MODE COM1:9600,n,8,1,p) BEFORE running DOC. X-On/X-Off handshaking is automatically provided for serial printers. You can set the output port to "FILE". In this case, DOC will ask for the name of a disk file when you start printing and will then print to disk rather than to a printer. If the file you name already exists, DOC will append pages to it. DOC does not support PostScript printers. If you have one of these, you might like to use the print to FILE option and then use a PostScript conversion program or word processor to print the resulting file. 2. Lines per page This is the number of printable lines on each page on your printer. DOC will print with this set incorrectly but will not be able to put page breaks and headers in the right place. The default is 70 lines for A4 fan-fold paper at 6 lines per inch, typical of many dot-matrix printers. Other common values are 64, 66 and 72. If you have difficulty with this setting, a workaround is to set the form-length correctly on your printer, enter a small number of lines per page (e.g. 60) and then select the "Use form-feeds" option. 3. Use form-feeds Set this option to Yes if you're using a LaserJet- style printer or any printer with the form-length set correctly. DOC will work with this option set to No by counting output lines but this is slower. 4. Pause between pages Set this option to Yes if you're feeding single- sheets to the printer... DOC will pause for you to get the next sheet ready between each page. Using document files without DOC -------------------------------- The HOTUTIL.TXT document file can be accessed by programs other than DOC though this may not be as convenient. It's a plain ASCII text file, with a line-feed/carriage return pair at the end of every line so it can be viewed with normal DOS commands such as TYPE HOTUTIL.TXT | MORE or COPY HOTUTIL.TXT PRN, text editor programs or other file viewers and browsers. The only unusual aspect is that the file contains multiple documents separated by lines beginning with two @ signs and a title for that particular document. DOC uses these to provide its list of available documents. If you're using HOTUTIL.TXT outside of DOC, you may wish to break the file at these lines. Customising the utilities ------------------------- Some of these utilities are compact assembly language .COM programs to make them small, fast and efficient. This means that some of the programs do not include built-in configuration options. However, if you're experienced with DEBUG, you can 'patch' the programs to customise their operation. The manual for each program will describe the ways in which it can be customised but typically you can do so to: * Customise the screen colours the program uses (if the display is hard to read on your screen). * Change the 'Hotkey' used by one of the TSR programs to avoid a conflict with your other software. * Change defaults such as sorting order, size of records and so on. To customise a utility, follow this general procedure in conjunction with the manual for the program. (You SHOULD NOT ATTEMPT this if you are not confident about using DEBUG as a mistake may stop the program from working or even crash your PC.) 1. Always MAKE A COPY of the .COM file for the program in question as a back-up. For example, assuming you were patching a program called POP-CAL.COM, you might enter: COPY POP-CAL.COM ORIGCAL.COM 2. Start DEBUG with the name of the program to modify. You must have the DOS DEBUG program available for this to work. For example, enter DEBUG POP-CAL.COM DEBUG loads the file and presents a - prompt. 3. Use the DEBUG E command to modify the areas of the program as described in its documentation. For example, assume the hotkey for POP-CAL can be changed by entering a new keyboard scan code at location 174. If we wanted to use Alt-P rather than Alt-C we can see from the scan code (SS) table below that we need to change this to code 19. This can then be entered in DEBUG with: E174 19 4. After making all the necessary changes, save the file back onto disk with the W command. Enter W 5. Now leave DEBUG. Enter Q 6. Now load and test out the new program. If it no longer works, delete it, restore your back-up copy (e.g. COPY ORIGCAL.COM POP-CAL.COM) and then try again. The tables below list the values necessary for customising colours and hotkeys. Keyboard scan codes for alternative hotkeys (Values for SS) ----------------------- Scan Scan Key Code (hex) Key Code (hex) -------- ---------- --------- ---------- Esc 01 Z 2C 1 ! 02 X 2D @ 2 03 C 2E # 3 04 V 2F $ 4 05 B 30 % 5 06 N 31 ^ 6 07 M 32 & 7 08 < , 33 * 8 09 > . 34 ( 9 0A ? / 35 ) 0 0B R Shift 36 _ - 0C PrtSc * 37 + = 0D Alt 38 Bkspace 0E Spacebar 39 Tab 0F CapsLk 3A Q 10 F1 3B W 11 F2 3C E 12 F3 3D R 13 F4 3E T 14 F5 3F Y 15 F6 40 U 16 F7 41 I 17 F8 42 O 18 F9 43 P 19 F10 44 { [ 1A NumLock 45 } ] 1B ScrlLk 46 Enter 1C 7 Home 47 Ctrl 1D 8 UpArr 48 A 1E 9 PgUp 49 S 1F - 4A D 20 4 LArrow 4B F 21 5 4C G 22 6 RArrow 4D H 23 + 4E J 24 1 End 4F K 25 2 DnArr 50 L 26 3 PgDn 51 : ; 27 0 Ins 52 " ' 28 . Del 53 ` 29 SysReq 54 L Shift 2A F11 57 | \ 2B F12 58 Shift Mask codes for alternative hotkeys (Values for MM) ----------------------- Value Alt Ctrl L-Shift R-Shift ----- --- ---- ------- ------- 0 1 X 2 X 3 X X 4 X 5 X X 6 X X 7 X X X 8 X 9 X X A X X B X X X C X X D X X X E X X X F X X X X X signifies that this key must pressed. For example, to use Left Shift and Right Shift for the hotkey, the value to use for MM would be 3. Colour values --------------- Black 0 Blue 1 Green 2 Cyan 3 Red 4 Magenta 5 Brown 6 Lt Gray 7 Dark Gray 8 Lt Blue 9 Lt Green A Lt Cyan B Orange C Violet D Yellow E White F A full colour value is two hex digits, the first for the background colour and the second for the foreground. For example, bright white on a dark blue background is 1F. Do not choose light colours (values larger than 7) for the background as it will produce a blinking display in most of the programs. @@2FILE & 2FLOPPY 2FILE & 2FLOPPY Steve Cooper Floppy disk image copying Version 1.1 ------------------------------------------------------- Purpose ------- 2FILE creates an exact, sector-by-sector copy of a floppy disk as a single hard disk file for modem transmission, multiple floppy duplication and so forth. 2FLOPPY provides the opposite capability, formatting and writing a new floppy disk from a file produced by 2FILE. 2FILE and 2FLOPPY support all 5.25-inch and 3.5-inch DOS diskette formats. Format ------ 2FILE d: [e:][\path\]filename[.ext] and 2FLOPPY d: [e:][\path\]filename[.ext] [/number] [/q] [/v] Using 2FILE ----------- The d: parameter is the drive containing the floppy disk to be copied, and filename is the name to be given to the 2FILE copy. A default .FLP extension will be supplied if none is specified, and the currently-logged hard drive and path will be used for storage unless otherwise specified with the optional e: and \path\ parameters. The hard disk must have enough space to hold the entire floppy plus a 13-byte header. Files created with 2FILE can be compressed before modem transmission with ARC, PKARC, PKZIP and similar utilities. Using 2FLOPPY ------------- The d: parameter is the drive containing the floppy disk to be formatted and written to. The filename is that of the 2FILE source file, which is assumed to be located on the currently-logged hard disk and directory unless the e: and/or \path\ parameters are supplied. The 2FILE source is presumed to have the default .FLP extension unless an .ext is specified. The optional /number parameter is used when a number of floppy diskettes are to be made from the same 2FILE source. Values for /number may range from 1 through 32,767 (default: 1). The user will be prompted with a message and a beep to insert new floppies, as needed. To silence the beep, use the /q parameter. Copies are verified unless the /v parameter is specified. The /q and /v switches may be entered in either upper- or lower-case. Notes ----- 1. Just like the DOS DISKCOPY command, 2FILE and 2FLOPPY produce exact copies of a disk, preserving any file fragmentation on the disk. If you're sending a .FLP file via modem to someone, you might want to ensure that your original disk is unfragmented before you use 2FILE on it. 2. 2FLOPPY formats and writes over the destination disk with the 2FILE-produced file. ANYTHING ALREADY ON THE DISK WILL BE LOST so make sure you only use it on a new or unwanted floppy. @@BAT2EXEC BAT2EXEC Douglas Boling Batch file compiler Version 1.5 ------------------------------------------------------- Purpose ------- BAT2EXEC compiles your batch files to .COM files for added speed. Large batch files often run annoyingly slowly so BAT2EXEC is a good way to increase both your productivity and satisfaction. Format ------ BAT2EXEC FILE.BAT Using BAT2EXEC -------------- Daily PC operations are almost unimaginable without the use of batch files. Everyone has their favourite collection of them, and some users have constructed complex batch files of thousands of bytes that push the batch language itself to its limits. Programs that expand the available batch file functions, such as Michael Mefford's BATCHMAN, encourage users to make even larger batch files. Unfortunately, however, batch files are also notoriously slow. It can be almost painful to watch them scroll down the screen a line at a time. A standard way to improve the speed of interpreted programs, such as batch files, is to compile them. That's where BAT2EXEC comes in. Using BAT2EXEC could hardly be simpler. Just enter BAT2EXEC FILE.BAT where FILE.BAT is the name of your batch file. BAT2EXEC will then produce an executable .COM file with the name FILE.COM. If BAT2EXEC can't find the batch file, an error message will be printed. If BAT2EXEC can't understand a line in the batch file, it will print an error message indicating the line in the file in which it discovered the error. BAT2EXEC should not be used on every batch file. AUTOEXEC.BAT, for example, must remain a genuine batch file in order for COMMAND.COM to find it. Similarly, batch files that run terminate and stay resident utilities (TSRs) should not be compiled. The reason for this limitation lies in the DOS memory management structure: if a TSR is executed from a program compiled by BAT2EXEC, the memory used by BAT2EXEC itself will not be made available to the system after it terminates. Programs created by BAT2EXEC behave slightly differently from the batch files from which they were compiled. The .COM file does not echo each line to the screen as does the batch file, for example. Running other batch files does not cause the .COM program to end. Also, pressing Ctrl-Break does not present the message, "Terminate Batch file (y/n)." If Ctrl-Break is pressed and BREAK has been set on, the program simply terminates. The size of the resulting .COM file is somewhat larger than the batch file. Compiling a batch file containing a single REM statement results in a .COM file size of 68 bytes, illustrating the overhead of the setup and terminate routines. Program size increases quickly as routines are added then slows as the loaded routines are reused instead of new ones being added. Certainly, BAT2EXEC is not suitable for use on every batch file. Two and three line batch files are best left in their easy-to-alter and simple-to-understand ASCII format. However, for those batch files that have grown into long complex programs, BAT2EXEC is the answer. @@BATCHMAN BATCHMAN Michael J. Mefford Batch file enhancement utility Version 1.1 ------------------------------------------------------- Purpose ------- BATCHMAN, is designed both to give your batch files significantly more power and to add many of the refinements we all wish DOS provided. You can check the DOS version, available memory, or display type and then branch accordingly. You can create colourful menus that branch on a user keypress. And, among its many other capabilities, BATCHMAN will let you adjust the keyboard typematic rate and tame the grating DOS beep or turn it into a tune. BATCHMAN is actually a collection of 48 batch file enhancement utilities, all rolled into one 6K program. This provides more than convenience: if BATCHMAN's utilities were stored separately, at a minimum one cluster each, they'd take up about 100K of disk space. Format ------ BATCHMAN [command] [arguments] [/R] Entering BATCHMAN without any parameters (or with an invalid parameter) will bring up a multi-screen display that lists all the BATCHMAN commands. The optional arguments are parameters for any given command. If you add the optional /R switch, BATCHMAN will display the EL returned from the command. The Report option will be most helpful when you are designing and debugging your batch files. Be sure to place BATCHMAN in a directory included on the DOS PATH so your batch files can find it. Batchman and ERRORLEVELs ------------------------ The key to BATCHMAN's operation is the ERRORLEVEL code, a number that programs can report to DOS when they terminate and that can be acted upon from a batch file. I'll abbreviate ERRORLEVEL as EL for the remainder of this documentation. An EL can have a value between 0 and 255. Each of the BATCHMAN commands returns information as an EL. An explanation of the syntax of each of the BATCHMAN commands and the ELs they return will be found below. The BATCHMAN commands --------------------- The following conventions are used in the explanations below. The commands are listed first, followed by any parameters they might accept, followed by the EL the command will return. The EL is given in curly brackets to make it clear that it is not part of the command syntax and should not be typed in. For example: CLS [nn] {EL=0} Entered without the optional nn colour argument, the command: BATCHMAN CLS will clear the screen with whatever colour it finds at the current cursor position. This provides the most flexibility when you plan to distribute a BATCHMAN batch file to other systems because it retains the user's custom colour scheme. If you wish to control the CLS colour, just add the colour argument nn, where nn is a decimal or hexadecimal value. Hexadecimal numbers need a suffix of "h" to distinguish them from decimal. Selecting a colour in hex is easier than decimal because each of the 16 possible values for each of the background and foreground colours fits into a single digit: the first digit is background, the second foreground. To clear the screen so that subsequent DOS output will use blue letters on a light gray background, for example, you would enter: BATCHMAN CLS 71h The first number (7) is the background colour, and the second (1) is the foreground colour. To do the same using a decimal number requires a little maths: the background colour is multiplied by 16 and added to the foreground. In the above example, the decimal equivalent would be (7 * 16) + 7 = 113, so the equivalent command in decimal would be: BATCHMAN CLS 113 Like its DOS counterpart, BATCHMAN's CLS also homes the cursor to the top left corner. Unlike the DOS CLS, however, BATCHMAN's will clear the whole screen properly in video modes such as the EGA/VGA 43/50 line modes. CECHO [C] [nn,]string{EL=0} CECHO is similar to the DOS ECHO command except you can choose the colour of the echoed string. The nn colour value is entered in the same manner as with CLS, and again, if you don't enter a colour value, BATCHMAN will use the currently specified colour. To echo a "Zowie!" to the display in an eye-catching blinking yellow on red, you would enter: BATCHMAN CECHO CEh,Zowie! The C (hex) value for the background colour normally displays as orange for a foreground colour. When used as a background colour, however, it displays as the blinking low intensity counterpart, red. Keep in mind that any high intensity colour selected for the background will blink in its corresponding low intensity colour value. The optional C parameter shown in CECHO syntax (don't confuse it with the hex C colour value in the immediately-preceding example) stands for "no carriage returns." Normally, both CECHO and the DOS ECHO move to the next line after echoing a string. At times this is not desirable. For example, you might wish to echo two strings, with different colours, on the same line. With BATCHMAN you can suppress the carriage return by adding a solitary C as the first argument. For example, to display a red on yellow blinking "Zowie!" followed by a normal red on yellow "Batchman!" on the same line your batch file would consist of: ECHO OFF BATCHMAN CECHO C CEh,Zowie! BATCHMAN CECHO 4Eh,Batchman! You can suppress the carriage return to prevent the display from scrolling when you echo to the last line of the display. This feature makes full screen menus feasible, whereas echoing to the last line with the DOS ECHO command causes the screen to scroll, spoiling any previous display layout. SETLOOP [n] {EL=0} . . DECLOOP {EL=SETLOOP-1} You use the SETLOOP and DECLOOP commands when you want to repeat a set of batch file commands. SETLOOP sets a loop counter to the n argument, which can be a decimal number between 0 and 255. Once the counter is set, the BATCHMAN DECLOOP command will decrement the counter each time it is executed and return the new value of the loop counter as an EL. The short batch file: ECHO OFF BATCHMAN SETLOOP 10 :HERE BATCHMAN CECHO ZONK! BATCHMAN DECLOOP IF ERRORLEVEL 1 GOTO HERE will echo "ZONK!" to the display 10 times before terminating. The batch processor will branch to the HERE label as long as EL is 1 or greater. Programmers may wonder where the loop counter is stored while other commands are executing. For the SETLOOP and PUSHPATH commands (PUSHPATH/POPPATH will be discussed below) BATCHMAN creates a small TSR of approximately 500 bytes. The loop counter uses one byte for its storage; the balance is reserved for path strings. When the loop counter becomes zero, the BATCHMAN TSR data area is returned to the system memory pool (unless PUSHPATH is also using the data area). Note that since the loop counter is only one byte, you can not do loop nesting. If you exit a batch file before SETLOOP has decremented to zero, the TSR data area will not be released. You should construct your batch files so that any early exit from a loop will execute a SETLOOP 0 to force a recovery of the TSR data area. BATCHMAN is smart enough not only to find its previous TSR data, but will prevent the creation of another if you try to enter two SETLOOP commands. QFORMAT [d:] [N] {EL=0 if successful; EL=1 if not.} QFORMAT is designed to wipe out all the files and subdirectories on a floppy disk at a single stroke. To keep you from accidentally trashing your hard disk, the command will only accept A: or B: as drive arguments. All other drive requests are ignored, and you can omit the drive argument only if A: or B: is your current default drive. As a further precaution, QFORMAT warns you that all data will be lost and requires that you press Y and Enter to confirm. Any other keypress will abort the process. If you don't want BATCHMAN to pause and ask for your approval, however, you can add the optional N argument to the command. The N stands for No Ask. Use this option with caution! QFORMAT will work only on diskettes that have already been formatted by DOS. The DOS FORMAT command puts vital information about the media type, number of clusters per FAT, and so forth, in the boot sector of the disk. BATCHMAN's QFORMAT command uses this information to find and place zeros in the FAT and root directory sectors of the disk. The reason why QFORMAT can be so fast is that it doesn't have to do the same work as the DOS FORMAT command. FORMAT not only does a low level format but also writes over the entire data area of the disk. It's the low-level-and-data-format process that takes forever. A low level format really needs be done only once, and QFORMAT blithely skips that step. QFORMAT is sophisticated enough to preserve bad sector information, however. PUSHPATH {EL=0 if successful; EL=1 if not} . . POPPATH {EL=0 if successful; EL=1 if not} PUSHPATH saves the current drive and directory, which can then later be restored with POPPATH. Typically, a batch file that executes an application includes a DOS CD command (often a change of drive as well) move operations to the place where the application resides. After the application terminates, it's usually desirable to return to the original path. By way of example, to run Lotus 1-2-3 on drive D: and then return to the default path afterwards, your batch file would look something like this: BATCHMAN PUSHPATH D: CD \123 123 BATCHMAN POPPATH PUSHPATH saves the current path in a TSR data area, just as the SETLOOP command does. While only one byte is reserved for SETLOOP's loop counter, however, BATCHMAN's TSR data area allows stacking up several paths with PUSHPATH. Subsequent POPPATH commands will retrieve the paths in a LIFO (Last In First Out) stack basis. Suppose, for instance, that you're currently in your directory and you issue the following commands: BATCHMAN PUSHPATH CD \DOS BATCHMAN PUSHPATH CD \PCMAG BATCHMAN POPPATH BATCHMAN POPPATH In this sequence, the first POPPATH puts you back into the \DOS subdirectory, and the last POPPATH restores you to the root directory from which you started. The number of path layers that can be stored will vary with the length of each path pushed onto the stack. BATCHMAN's TSR area reserves 408 bytes for paths, which allows for 6 levels of nested paths if each path is the maximum 65 characters allowed by DOS. Shorter path names will allow nesting greater than 6 levels. BATCHMAN returns an EL of 1 if it finds the stack too full for another PUSHPATH or if the stack is already empty with a POPPATH. Otherwise, the EL returned is zero. When the last path is popped off the stack, the TSR data area is discarded and returned to the DOS memory pool. ANSI {EL=0 if ANSI found; EL=1 if not found} This BATCHMAN command is designed simply to determine whether ANSI.SYS is or is not installed. If the EL is 1 you can then branch around any ANSI.SYS escape sequences contained in your batch files. BATCHMAN is smart enough to detect ANSI.SYS, but it will not find other ANSI.SYS emulators, such as DesqView's DV-ANSI. BEEP [m,n[;m,n]...]{EL=0} The BATCHMAN BEEP command gives you a great deal of flexibility in controlling the frequency and length of the sound DOS emits in response to a Ctrl-G character. The m,n beep arguments are decimal numbers and are used in pairs, separated by a comma. The m value represents the frequency (in Hz.), and n is the number of 1/18th second increments that comprise the duration. The command for a middle C beep of a 1/2 second, for example, would be: BATCHMAN BEEP 262,9 By separating the argument pairs with semicolons, you can produce a series of tones with the same BEEP command. You might, for example, find it interesting to try: BATCHMAN BEEP 392,3;523,3;659,3;784,3;10,3;659,3;784,12 The lowest valid frequency is 19, a very low buzzing sound. You can use a value less than 19 to create pauses between tones: no sound will be emitted, but the duration argument is executed, effectively producing a programmable delay between notes. If you omit all arguments, BEEP defaults to 1046,1 -- a C note for 1/18 of a second. The DOS Ctrl-G beep is a frequency of 886 that lasts for one second. Musically, a frequency of 886 is an out-of-tune A, which probably explains why it grates on so many ears. WAITTIL hh:mm[ss] {EL=0 if successful; EL=1 if aborted} WAITTIL provides a convenient way to pause until a certain time of day. The hh:mm:[ss] argument is the time in hours, minutes, and optionally seconds. BATCHMAN will wait until the specified time arrives but you can manually abort the wait by entering any keystroke. A typical application for WAITTIL would be to execute an electronic bulletin board communications program that would automatically download messages late at night when rates are lower. WAITFOR [mm:]ss {EL=0 if successful; EL=1 if aborted} WAITFOR simply pauses for a specified number of minutes (mm) and seconds (ss). You can omit the minute part of the argument if you desire. As with WAITTIL, the WAITFOR delay can be over-ridden by pressing a key. CURSORTYPE [m,n] You can use CURSORTYPE either to create a cursor size that suits your taste or to restore the normal underline cursor after an application alters it. Entering CURSORTYPE without any arguments will default to the standard underline cursor. To create a custom cursor, you supply the m,n arguments as the start and stop line values. These values can be either decimal or hex; for hex input, add an "h" suffix to the number. The top of the character box is logical line zero; successively-numbered lines increment downward. The valid scan line values used for m and n are 0-7 for a CGA, 0-13 for a monochrome or EGA, and 0-15 for a VGA. The default underline cursor start/stop lines are 6,7 for a CGA, 11,12 for a monochrome or EGA, and 13,14 for a VGA. To set an EGA solid block cursor, for example, enter: BATCHMAN CURSORTYPE 0,13 Note that the EGA BIOS on some video boards will attempt to override your selections. BATCHMAN temporarily turns off this BIOS EGA emulation logic for all video boards when the cursor type is set, and this seems to work for most systems. However, if entering CURSORTYPE without arguments does not give you the normal default underline cursor, you can explicitly request an underline cursor that fits your display. You may need to do this for video modes other than the normal 25 line modes. A "wrap around" cursor, in which the stop line has a lesser value than the start line, is supported by the hardware of only some video systems. BREAK {EL=0 if OFF; EL=1 if ON} The BATCHMAN BREAK command returns the current state of DOS's Ctrl-Break checking. You can change the state of BREAK with the DOS command of the same name. DRIVEEXIST d: {EL=1 if exist; EL=0 if not} DIREXIST directory {EL=1 if exist; EL=0 if not} These two BATCHMAN commands are used to return an EL of 1 to your batch files if the specified variable exists. ISVOL [d:]volume {EL=1 if exist; EL=0 if not} Similarly, this command returns an EL of 1 if a particular disk volume exists on the named drive. YEAR {EL=year from 1980 (0-199), where 0=1980} MONTH {EL=(1-12)} DAY {EL=(1-31)} WEEKDAY {EL=(0-6), where Sun=0; Sat=6} HOUR {EL=(0-23)} MINUTE {EL=(0-59)} SECOND {EL=(0-59)} This group of BATCHMAN commands returns the system time and date. Note that you can obtain a relatively fine resolution of the time. VIDEOMODE {EL=(0-19)} The EL returned by the VIDEOMODE command allows you to determine which of the possible screen modes listed in Figure 3 is currently being used by your display. ROWS {EL=display rows} COLS {EL=display columns} These obvious but very handy commands return the current number of rows or columns displayed. SETCURSOR m,n {EL=0} By supplying values for m (the row) and n (the column) you can use SETCURSOR to place your cursor at the specified screen location. By using SETCURSOR in concert with CECHO you can precisely control the location of your messages. For example, to display "Gotham City" in blue in the middle of the screen, you would create the following batch file: ECHO OFF BATCHMAN SETCURSOR 12,35 BATCHMAN CECHO 1,Gotham City Be sure to include the ECHO OFF command, both so that DOS won't spoil your display by echoing the commands, and so that the cursor won't return to the beginning of the next line for the CECHO command. A related use of SETCURSOR is to hide the cursor. You can do this by setting the cursor to display on line 26, which is off screen. Be sure to issue a second SETCURSOR command that puts the cursor back on screen once the hidden cursor is no longer needed, or you won't be able to see what you type! If you forget, don't panic. Just press Esc, blindly type CLS and press Enter, and things will return to normal with the cursor homed to the top of the display. E43V50 {EL=0 if successful; EL=1 if not} This BATCHMAN command loads the 8x8 BIOS font for an EGA or VGA monitor. This changes the number of lines displayed to 43 (EGA) or 50 (VGA}. You can use the DOS MODE command to return to the normal 25-line display. PRTSC {EL=0} This command will execute a printer screen dump exactly as if you had pressed Shift-PrtSc on an 83-key keyboard or the dedicated Print Screen key on a 101-key keyboard. COMPARE string1 string2 {EL=0 if match; EL=1 if no match} The BATCHMAN COMPARE makes a case insensitive comparison between two strings. For most purposes you'll probably want to use COMPARE instead of the case sensitive DOS batch command: IF string1==string2 With the DOS IF string comparison a non-case sensitive match requires two tests -- one for uppercase and one for lowercase. Even this does not guarantee a match if the string is a mixture of upper and lower case, as might occur if a batch file were looking for a person's name, for example. COMPARE solves this case problem. Note that the BATCHMAN COMPARE does not need the double equal signs the DOS IF command uses. CANCOPY filespec [d:] {EL=0 if room to copy; EL=1 if not} Before you copy a file or a number of files to another drive (especially a floppy disk drive), you can use CANCOPY to see if there is enough room for all the specified files. The filespec you supply can use the DOS ? and * wildcards. If you don't specify the target drive, the default drive is checked. Thus, for example, to check whether the collection of PC Magazine utilities you keep in a directory called PCMAG on drive C: will fit onto a floppy, you would enter: BATCHMAN CANCOPY C:\PCMAG\*.* A: BATCHMAN returns an EL of 0 if there is room; otherwise a 1 would be returned. If you enter this from the DOS command line, you'll want to include the /R option to see the EL returned on screen. WARMBOOT COLDBOOT As their names imply, WARMBOOT and COLDBOOT reboot your system. WARMBOOT does the same thing as pressing Ctrl-Alt-Del; COLDBOOT is like hitting the big red switch. A COLDBOOT does a memory check (among other things) that WARMBOOT does not, and it takes a lot more time. Of course, be forewarned that with either of these commands all unsaved data in RAM memory will be lost. Note that WARMBOOT and COLDBOOT may not work on some non-compatible systems. SHIFT ALT | CTRL {EL=1 if depressed; EL=0 if not} This command returns the state of either the Alt or Ctrl key. For example, BATCHMAN CTRL returns an EL of 1 if the Ctrl key is currently depressed. You can use the SHIFT command along with the BATCHMAN GETKEY command without arguments to detect alternate key presses. (See GETKEY, below, for an example.) NUMLOCK [ON | OFF] {EL=0} CAPSLOCK [ON | OFF] {EL=0} SCROLLOCK [ON | OFF] {EL=0} These three self-explanatory commands toggle the current shift state of the NumLock, CapsLock or ScrollLock keys when used without the ON or OFF options. They explicitly turn the three keys on or off if the optional arguments are supplied. Thus, for example: BATCHMAN NUMLOCK will toggle the NumLock state on if it was off or off if it was on. Entering BATCHMAN NUMLOCK OFF will turn the NumLock state off regardless of whether it is currently on or off. This latter would be a useful line in your AUTOEXEC.BAT if you use the numeric keypad for cursor navigation instead of number entry. Note that on some keyboards the LED indicator lights may not faithfully track changes in shift status. RENDIR old new {EL=0 if successful; EL=1 if not} The RENDIR command will rename a directory, but only on systems using DOS 3.0 or later. To use it simply enter the path of the old directory and the new name. For example, to change the name of a temporary directory named TMP on the C: drive to a permanent name, say, ROBIN, you would enter: BATCHMAN RENDIR C:\TMP C:\ROBIN Be sure to include the complete path for both the old and new directory names if the directory is other than the default. ROMDATE {EL=0} ROMDATE displays the eight bytes of the BIOS date at address FFFF:0005 of the ROM BIOS. Usually, the display will be something like 10/07/87, but some clone BIOSs do not have a date. If no ASCII numbers are found, BATCHMAN displays nothing. GETKEY ['string' n] {EL=scan code if no ['string' n] list; else EL=position in list.} There are probably hundreds of versions of the batch file GETKEY program. They return the scan code of the next key you press as an EL. If you enter the BATCHMAN GETKEY command without the optional (bracketed) arguments, it will do the same thing. Entered without arguments, GETKEY can also be used with the BATCHMAN SHIFT command to detect Alt- or Ctrl- key combinations. The scan code for the "Q" key is 16. To check for an Alt-Q keypress (perhaps as a Quit key command), you would use the following batch file: ECHO OFF GETKEY BATCHMAN GETKEY IF NOT ERRORLEVEL 16 GOTO GETKEY BATCHMAN SHIFT ALT IF NOT ERRORLEVEL 1 GOTO GETKEY ECHO Alt-Q was pressed. GETKEY's optional key list provides still another kind of functionality with its optional key list. The information you need may not be the scan code of a given key, but rather its position in a string. If you supply the optional 'string' argument to GETKEY, BATCHMAN will wait either until one of those keys listed has been pressed or until you break out of the command with Ctrl-Break or Ctrl-C. An example may helpful here. With the command: BATCHMAN GETKEY 'yn' BATCHMAN will wait until either the "Y" or the "N" key or one of the break keys mentioned above is detected. All other keypresses are ignored, and if the break-out keys are pressed, the EL returned will be 255. GETKEY is not case sensitive, so if either "Y" or "y" is pressed, the EL will be 1, since the "y" is the first character in the string of valid keypresses. For "N", an EL of 2 will return. The string must be enclosed in a pair either of single or double quotes. If you want the single quote included as a valid keypress, enclose it in double quotes and vice versa for double quotes, as in the following example: BATCHMAN GETKEY '"' You can also include the function keys (even the F11 and F12 keys of the extended keyboard) in the GETKEY list. The function key numbers are listed without quotes, (they are designated by the n in the command syntax above), and may or may not be further identified with a leading "F." Multiple function keys are delimited by either a space, comma or semicolon. To add the F1 and F2 as valid keys to the "yn" string example above, you would enter either: BATCHMAN GETKEY "yn" F1 F2 or just BATCHMAN GETKEY "yn" 1 2 If F1 is now pressed, the returned EL will be 3, since F1 is the third entry in the list. DOSVER {EL=(major*32)+minor} DOSVER returns an EL representation of the DOS version in use. DOS version numbers have two parts, the Major version (the number to the left of the decimal point) and the Minor version (the number to the right). For DOS version 3.10, then, 3 is the major and the 10 is the minor. Since the largest EL number is 255, the DOS version number does not fit conveniently into an EL. For DOS 3.10, for example, if the dot is discarded the remaining 310 is too large for an EL. Of course, BATCHMAN could be content to return only the major number, truncating anything after the dot, or even the first digit after the dot. But that would be less than sufficient for some applications. So instead, the DOSVER command compresses the version number by multiplying the major number by 32 and adding it to the minor number. With DOS 3.30 the result will be (3*32)+ 30=126; with DOS 4.00 it would be 128. If there had been a DOS version 3.32 we would have a problem of course, since this would also return 128. Historically speaking however, we are safe here. MAINMEM n | R {EL=0 if enough} EXPMEM n | R {EL=0 if enough} EXTMEM n | R {EL=0 if enough} The arguments for these three memory commands can be either a decimal number, n, or an R. The decimal argument is used to check whether the desired amount of memory (in KB) is free. If BATCHMAN finds that there is enough free memory to meet the request, the EL will be 0. Thus, if an application needs 512K bytes of the 640K maximum possible with DOS, you would enter: BATCHMAN MAINMEM 512 The EL will return 0 if there are at least 512K bytes free; otherwise, a 1. Your batch file can then branch to an error message if there is not enough memory to run the application. Note that these memory commands do not allocate the memory. They only check if it is free. The alternative R argument stands for Report and will display the current free memory of the type requested on the screen. To see how much free expanded memory you have, for example, enter: BATCHMAN EXPMEM R The report option of the three types of memory will go nicely with BATCHMAN's ROMDATE command in a system information batch file. DISPLAY {EL=display type} The DISPLAY command will report on the type of display your system has installed. The values returned by DISPLAY as EL codes are: 1=MDA 2=CGA 4=EGA colour 5=EGA mono 6=PGS 7=VGA mono 8=VGA colour 11=MCGA mono 12=MCGA colour CPU {EL=CPU type} Similarly, the CPU command returns an EL that indicates the microprocessor used by your machine. The specific EL numbers are: 1=8086/8088; 2=80186; 3=80286; and 4=80386. WINDOW m,n,w,h[,c,b] {EL=0 if successful; EL=1 if not} The powerful WINDOW command displays screen boxes. It provides several parameters and options. The first two decimal numbers (m,n) are the row and column of the top left hand corner of the window. The next two decimal numbers (w,h) are the desired width and height of the window (including the border characters.) The smallest size that WINDOW allows is 2 characters in width and height. The optional fifth parameter, c, can be either a hexadecimal or decimal number for the colour of the window. If no colour argument is supplied, the current colour of the screen is used by default. The last parameter, b, sets the type of border used to surround the window. If no parameter is found, spaces are used. If you enter a minus sign for b, a single-line box character will be drawn. An equals sign for b will produce a the double-line box character. In all cases, the centre of the window is cleared with spaces of the chosen colour. For example, the command BATCHMAN WINDOW 1,1,80,25,17h,= will create a blue window with white double line box characters that will fill the entire screen, making a nice menu frame. Text could then be added with the BATCHMAN SETCURSOR and CECHO commands. TYPEMATIC [m,n | N] {EL=0 if valid parameters; EL=1 if not} m=typematic rate (0 - 31); larger m=faster rate n=initial delay (0 - 3); larger n=longer delay N=normal: m=20; n=1; default: m=25; n=0 TYPEMATIC works only with keyboards that support adjustable typematic (automatic key repeating) rates at the BIOS level. That includes most machines, starting with the AT, but not all clones. The first optional decimal parameter, m, is a number between 0 and 31 and represents the desired typematic rate. The larger the m value, the faster your keyboard will repeat keystrokes. The second parameter, n, has a range of 0-3, and sets the initial delay. This delay is the length of time you must hold down a key before it begins repeating. The larger the delay value the longer the delay. The delay parameters are in increments of 1/4 second, with 0=1/4 and 3=1 second. The typematic parameters are divisors and cannot be easily be translated into fractions of a second, however, and so should be thought of only as a gradient scale. If you don't enter any parameters, TYPEMATIC defaults to a repeat rate of 25 and a delay of 0. The 25 translates into about 17 characters per second with an initial delay of 1/4 second. You can restore the typematic rate to the normal hardware defaults (11 characters per second with a 1/2 second delay) by using the N parameter. Just enter: BATCHMAN TYPEMATIC N and the normal values of 20, 1 will be used. Once you try adding a little zoom to your keyboard, however, you probably won't ever go back to the hardware defaults. wUpdates ------- This updated version of BATCHMAN has enhancements to the GetKey and Shift functions. The Getkey function has been enhanced with respect to the command line arguments. In this version, unquoted numeric arguments represent scan codes instead of function keys. Any scan code is valid; thus, one can now check for Home, PgDn, or Tab as well as function keys. A drawback is that one must know the scan code for the desired key, including the twelve function keys. However, the previous mode of operation is still supported if one precedes the function key with an "f" (case-independent). The "f" is no longer optional. Finally, function key 0 has been defined as the "Enter" key. The Shift function now reports whether either of the shift keys is depressed. Use BATCHMAN SHIFT SHIFT. BATCHMAN returns Errorlevel 1 if either shift key is down; otherwise errorlevel 0. @@CDX CDX Michael Holmes and Bob Flanders Enhanced change directory command Version 1.3 ------------------------------------------------------- Purpose ------- Provides an alternative to the DOS CD command that eliminates the need to enter long path and directory names and that finds and changes to directories containing specified filenames. Format ------ CDX [/?] [/B] [/+] [/F filename] [d:]p1 p2 ..pn Remarks ------- Entered without any of the optional / switches, CDX searches one or more hard drives d: for a specified directory p1. If found, the full path is displayed with a ? prompt and is selected by typing Y; typing N continues the search for another qualifying directory. If the d: parameter is omitted, only the current drive is checked; *: searches all hard drives, starting with the first hard drive in the system. Multiple drives listed as d:, including floppies (if requested) are searched in named order, e.g. DCAB:. If d: is preceded by a minus sign (-) the drive(s) listed are excluded rather than included. The p1 target directory name can be truncated to as little as its initial letter. To prevent having to bypass an inconvenient number of qualifying directories at the ? prompt, multiple values of p, each separated by a space, can be used to construct an abbreviated path, which need not include all steps. If the initial p1 begins with a backslash (\) the search will be made from the root rather than the current directory. Using the /F switch limits qualifying directories to those containing a user-specified filename. The filename supports the * and ? DOS wildcards, and if all the subdirectories of d: are to be searched, p1 may be omitted or replaced by an asterisk (*). Supplying the /B switch automatically selects the first qualifying directory, eliminating the user prompt. The /+ switch causes floppy disk drives A: and B: to be included in the search. Executing CDX with no operands brings up a syntax help screen. In keeping with DOS conventions, entering CDX with a single dot, double dot, backslash or a single parameter that is the full name of a directory goes to the requested directory. An extension of this convention allows a disk name to be specified. For example, if you are currently on C: and you enter CDX D:\ABC you will be taken to the D: drive ABC directory. CDX can be forced to search by placing a * at the end of the parameter. @@CHKFRAG CHKFRAG Bob Flanders and Michael Holmes Reports on extent of file fragmentation Version 1.7 ------------------------------------------------------- Purpose ------- Reports on-screen the extent of file fragmentation on a hard disk and provides an ERRORLEVEL value usable within a batch file to call a defragmentation program. Format ------ CHKFRAG [d:] [/% | /N | /E] [/L] Remarks ------- Executed without any of its optional parameters, CHKFRAG produces a screen report indicating the number of files and directories, how many and what percentage of these are fragmented, and how many extra (non-contiguously stored) parts of files are contained on the currently-logged drive. An ERRORLEVEL code from 0-100, reflecting the percentage of fragmented files, (the /% parameter is the default) is also shown. An alternative drive (d:) to be analyzed may be specified, as may be ERRORLEVEL return codes that reflect the actual number of fragmented files (the /N parameter) or of extra sections (the /E parameter). The ERRORLEVEL return codes are not intended for strict accuracy: if any file is fragmented the minimum ERRORLEVEL returned by the /% parameter is 1%, and 254 is the maximum ERRORLEVEL returned by the /N and /E switch options. These return codes are intended to be used to trigger automatic loading and execution of the user's defragmenting utility from within a batch file. An ERRORLEVEL return code of 255 is used to indicate an error condition, which halts operation. If desired, a list of the names of fragmented files and directories can be produced by specifying the optional /L parameter. The normal screen output from CHKFRAG may be redirected to a file or to a printer, for easier analysis. The DOS CHKDSK command, specified with its /F switch, should be executed before running CHKFRAG; lost clusters or cross-linked files are interpreted by CHKFRAG as error conditions. Drives created with the DOS ASSIGN or SUBST commands, and directories created by JOIN are not checked by CHKFRAG. While analyzing large disks, the utility requires approximately 100KB of available RAM. CHKFRAG's on-screen recommendations are to consider using a defragmenting utility when file fragmentation is in the range from 11% to 75%, and definitely to defragment disks that show more than 75% fragmentation. Notes ----- 1. Version 1.7 of CHKFRAG is provided. You should replace any older versions of CHKFRAG you have with this version. @@DIRMATCH DIRMATCH Michael J. Mefford Compare two directories side-by-side Version 2.0 ------------------------------------------------------- Purpose ------- To display two scrollable, alphabetised, directory listings side-by-side, with the more recent of matching filenames highlighted; to provide mark, copy, and move facilities to update the target directory with one or more selected files from the source. Format ------ DIRMATCH source target [/D][/A] Remarks ------- The source and target may comprise any combination of drives, directories, or subdirectories (with optional * and ? wildcards) valid for the DOS DIR command. The user will be prompted for target and source directories if these items are incorrect. By default, DIRMATCH displays all files in the two directories. The optional /D and /A switches restrict the display to Different and Alike files, respectively. The on-screen display, together with the number-of-files counters, can be cycled through All, Different and Alike modes with F1; Shift-F1 cycles in reverse. Pressing Esc exits the utility. Crtl-C will abort the program operation. An inverse-video selector bar shows the current position in the listings, and may be moved with the UpArrow, DownArrow, PgUp, PgDn, Home, and End keys. When the selector bar is on a filename, pressing the plus (+) key on the keypad or the equal (+=) key on the keyboard marks the file for further action. Pressing the minus (-) key on the keypad or the hyphen (-) key on the keyboard unmarks a marked file. F2 marks all files; F3 clears all marks. A file under the selector-bar or a group of marked files can be copied from source to target directories by pressing F4. A confirming prompt is provided. Similarly, pressing F5 moves a file or marked group, by first copying and then deleting file(s) from the source. While older files can be copied (F4) to the target directory, by default F5 will not move them. F6 will delete the marked files from the source directory after prompting for confirmation. F7 moves marked files only if there are not existing files in the target directory with the same name. F8 reverses the source and target directories on the screen making the current source the target and the current target the source. This allows the user to move and copy files in any direction and to delete any file. This is especially helpful when updating two directories that have been maintained independently (e.g. at the office and at home) so that they will both have the latest versions of the same file. Pressing F9 prints a list of All files, with more recent matching filenames identified with a greater-than (>) sign. F10 displays the amount of free space on the target disk drive. DIRMATCH supports any number of screen display lines, including 43-line (EGA) and 50-line (VGA) modes. It can display up to 1,423 filenames in its listings. Hidden and read-only files are not displayed. DIRMATCH requires 64K free RAM in order to run. New features in Version 2.0: F6 Delete file(s) F7 Moves file(s) (if not already on Target directory) F8 Swaps Target & Source directories F9 Pressing F9 prints a list of all files, with more recent matching filenames identified with a greater-than (>) sign F10 Checks amount of free disk space in Target directory Colour patch addresses: EE9 Heading EEE File listings EF3 Bottom menu EF8 Highlight bar EFD Directory names & F1 active mode toggle F02 Recent Files How to use DEBUG to patch colours: Dark colours Light colours ------------ ------------- Black 0 Dark Gray 8 Blue 1 Lt Blue 9 Green 2 Lt Green A Cyan 3 Lt Cyan B Red 4 Orange C Magenta 5 Violet D Brown 6 Yellow E Lt Gray 7 White F To change an area's default colours (background & foreground), simply choose from the list of available colours above and substitute the corresponding values at the appropriate location. When choosing a colour combination, remember that the first value represents the background colour and the second value represents the foreground colour. NOTE: using a light colour as the background colour will result in blinking characters. For example, if you wanted to change the heading from the default colours of blue on gray to white on red, you would change the value at location EDF from "71" to "4F." Here is the sequence of DEBUG commands to do this: DEBUG DIRMATCH.COM (Tell DEBUG to load DIRMATCH.COM) E EDF 4F (Edit location "EDF" & replace value with "4F") W (Write the modified DIRMATCH.COM file to disk) Q ( Quit DEBUG) @@FFF FFF John Deurbrouck File finding utility Version 1.0 ------------------------------------------------------- Purpose ------- A file and directory-finding utility that can search all directories on any or all drives for one or more target filespecs. Extended wildcards, size and attribute information, and multiple report formats are supported. Format ------ FFF [/a] [drive(s):] [/d|do] [/h|ho|hro] [/s] [/l|t|w] name(s) Remarks ------- The name(s) parameter may consist of multiple entries (separated by spaces) on the same command line. Thus, FFF *.exe *.com *.bat will find all executable files on the current (default) drive. In FFF, * stands for 0 to n characters, ? for one and only one character; the period is treated specially as an ordinary character. Thus *.* and * both mean "all files" and *.?* restricts a listing to files that have at least a 1-character extension. Unlike normal DOS commands, combinations such as *C*T*.* are permitted, facilitating finding files with a basename that has, in this case, a C and a T in that order. All other parameters are optional and are not sensitive as to case or entry order. The /a switch causes FFF to search all system drives in alphabetic order. One or more drives may be specified, singly, in ranges, or intermixed, by entering a drive(s): parameter. This parameter must end with a colon, and included range(s) of drives (e.g. c-e:) must begin with the lowest letter drive in the group. By default, searches begin from the root directory of the drive(s) specified; the /s switch restricts the search to the current subdirectory and its children. The /d switch returns directories as well as files that match name(s); /do lists matching directories only. The /h switch adds hidden and system files; /ho restricts the listing to hidden and system files; and /hro reports hidden, system, and read-only files in addition to normal files. The default FFF report lists files and directories found under their parent directories and supplies file size, date and time, and attribute (archive, hidden, system, read-only) information on each. File size and allocation size totals are also supplied and a storage efficiency percentage is calculated. The /w (wide) switch reports entries individually, five across. The /l (limited) switch lists number of entries and total and allocated space. The /t (terse) switch reports fully-qualified names only. @@FILECTRL FILECTRL Michael J. Mefford Multi-format file viewer and browser version 1.1 ------------------------------------------------------- Purpose ------- A full-directory file-viewing and removal utility capable of displaying WordPerfect, Microsoft Word, Q&A Write, and WordStar documents as if they were in ASCII format. FILECTRL automatically supports normal 25-line, 43-line (EGA), 50-line (VGA) and UltraVision displays. Format ------ FILECTRL [filespec] [options] Remarks ------- Entered without any parameters, FILECTRL displays a filename list of the current directory in its left window and the first part of the text of the highlighted filename in its right window. The text is shown stripped of any header and formatting codes. Any drive and/or directory can be specified with filespec, and * and ? can be used to limit the file list. Pressing Esc exits the utility. The Tab key (a toggle) shifts between windows, as do the Left- and Right-Arrow keys. The display in the active window is shown in high-intensity colour, and scrolling within the active window uses the usual Up- and Down- Arrows, PgUp and PgDn, Home and End keys. From the file list window pressing a letter jumps the selection highlight to the first filename beginning with that letter and so continues with subsequent keypresses. F2 deletes a highlighted filename or empty subdirectory, and Ctrl-F2 deletes a group of marked filenames. Files can be marked with the + key and unmarked with the -; the spacebar toggles the mark on and off. All deletions are prompted for confirmation prior to execution. Pressing F5 successively (1) widens the file list to show full DOS directory information, (2) widens the text display to a full 80 columns, and (3) returns to the original display. Shift-F5 reverses the display sequence. Pressing Enter while a filename is highlighted toggles between the filelist display and the 80-column text display. Pressing Enter while a subdirectory (< >) or the parent (<..>) directory is highlighted loads the files from that directory. F3 permits entering a new filespec. By default FILECTRL sorts filenames in ascending alphabetical order. The F7, F8, F9, and F10 keys set the sort field to filename, extension, size, and date, respectively. Pressing F6 toggles between ascending and descending order. FILECTRL also permits entering a number of options as command-line switches. These are summarised below. /M+ = Include only files modified since last back-up /M- = Include only files NOT modified since last back-up /H = Include Hidden files /R = Include Read-only files /P date = Only include files ON or Prior date /A date = Only include files ON or After date (date format = mm/dd/yy) /W = WordStar files; remove high bit /N = Sort by Name /E = Sort by Extension /S = Sort by Size /D = Sort by Date /O = Sort by Original DOS DIR order (default is Sort by Name) /F = Sort in descending order For use with laptop computers it may be necessary to enter the DOS MODE BW80 command before executing FILECTRL. @@FREE FREE Based on a program by Art Merrill List disk free space version 1.0 ------------------------------------------------------- Purpose ------- FREE.COM reports the amount of free space, the amount of space used and the total space on one or more disk drives. This information is also reported by the DIR and CHKDSK commands but where a large number of files are present, FREE is much faster. Format ------ FREE [d:] [d:]... or FREE dd... Remarks ------- FREE is in many respects a companion program to FSIZE: the latter tells you how much storage space you must have to make your copies, the former tells you how much you do have. Unlike most DOS commands, you do not have to include the : after drive letters or even separate them with spaces. FREE C: D: is equivalent to FREE C D or even FREE CD. If you give more than one drive letter, FREE prints totals for the drives listed; if you hard disk is divided into C D and E partitions, FREE CDE will list the space on each partition and then the drive as a whole. Notes ----- 1. Requires DOS 2.0 or later. 2. This version of FREE updates the original PC Magazine FREE.COM written by Art Merrill @@FSIZE FSIZE Based on a program by Art Merrill List file sizes and space occupied version 1.0 ------------------------------------------------------- Purpose ------- Calculates the storage requirements of a file or group of files based on the number of DOS clusters necessary to make floppy disk and hard disk copies. Format ------ FSIZE filespec or FSIZE filespec d: Remarks ------- DOS stores files in fixed-length 'allocation units' or 'clusters'. For floppy disks, the cluster size is usually 1024 bytes (two 512-byte sectors). A standard XT 10Mb hard disk has a cluster size of 4096 bytes (8 512-byte sectors). AT hard disks typically have a cluster size of 2K (4 512-byte sectors). The cluster size is determined when the disk is formatted; larger clusters may be used on some drives, particularly large capacity units. The cluster size dictates how much disk space a file takes up. DOS always stores files in a multiple of the cluster size, if necessary padding out the last sectors of the file with random data. For example, with a 2K cluster size, a one byte file will still take up 2K (2048 bytes); the same space as a 900 byte one or a 2048 byte one. A 3000 byte file would occupy two clusters, using a total of 4096 bytes. Entered with a file specification, FSIZE lists the total size of the files given and the space they actually occupy on the disk. It also notes how much space is 'lost' to padding data and what the cluster size is on the drive holding the files. Underneath, FSIZE lists how much space would be required for the files on different types of disk. For example, if the files are currently on a hard disk, you can see how much free space is needed to copy them onto a floppy disk. Similarly, if the files are on a floppy, you can see how much space they would take up if you coped them to a hard disk. If you give a drive letter after the filespec, FSIZE determines the cluster size on that drive and reports how much space would be taken up by the files if they were copied to it, rather than producing a table of various values. Examples -------- FSIZE *.* Lists how much space files in the current directory take up. FSIZE A:*.PCX Lists how much space the PCX files on drive A take up. FSIZE C:\JAN Lists how much space files in the \JAN directory on drive C take up. FSIZE ACCOUNTS.WK1 B: Lists how much space the file ACCOUNTS.WK1 takes up and how much free space would be needed to copy it onto a floppy in drive B. Note that drive B (or whatever) must be ready for this to work as FSIZE needs to read the cluster size from the disk. Notes ----- 1. Requires DOS 2.0 or later. 2. From DOS 4 on, you can determine the cluster size on a particular drive with CHKDSK. You can do this with FSIZE and any version of DOS by running it with the name of any file on the disk 3. If you are copying files into sub-directories, remember that the directory entries themselves require disk space; DOS may fit the files into the existing directory on the disk or it may need to extend the directory by a cluster or two to cope. 4. FSIZE combines and updates the PC Magazine SIZE and ATSIZE utilities written by Art Merrill @@HC HUGECALC Neil Rubenking Long precision calculator Version 1.0 ------------------------------------------------------- Purpose ------- A command-line calculator utility that can perform addition, subtraction, multiplication, division, exponentiation, and factorial functions on numbers with up to 254 significant digits. Format ------ HC n operator [n] Remarks ------- The n operand variables may consist of any string of digits up to the 127-character maximum of the DOS command line. The operands must not include commas or other formatting punctuation, and must be separated from the command and the operator by at least one space. Two operands are required for all operations except factorial. The operators recognised are +, -, *, /, ^, and !. When output to the screen (the default) or redirected to a printer or other DOS device, HUGECALC prints the name of the function and inserts commas at every three digits in the numeric result. If the output is redirected to a file or piped to a program input, however, only the numeric result is sent. Note that when it accepts input from a file or via a pipe, HUGECALC uses that input as its first operand. This means that you can evaluate complex expressions with HUGECALC by using the DOS pipe (|) facility to string together several HC commands in sequence. Example ------- If a program that prints 10,000 permutations a second is asked to print all possible combinations of 13 characters, how long will it take? The command HC 13 ! | HC / 10000 | HC / 3600 | HC / 24 pipes the factorial of 13 (the possible combinations) to a second instance of HC, which divides it by 10,000 (the permutations per second). The result is piped to a third instance of HC, which divides it by 3600 (the seconds in an hour), and finally to a fourth instance of HC, which divides it by 24 (the hours in a day). The answer printed on the screen is: QUOTIENT: 7 REMAINDER: 4, that is, 7 days, 4 hours. Note that all such chained calculations must be strictly sequential and that parenthetical expressions are not supported. @@INSTALL & REMOVE INSTALL & REMOVE Jeff Prosise TSR management programs Version 1.0 ------------------------------------------------------- Purpose ------- INSTALL and REMOVE are a pair of programs that allow you to load and unload TSR (memory-resident) type programs in a safe way, even with programs that do not provide their own uninstall or unload feature. INSTALL is used before loading a memory-resident program. Subsequently REMOVE will remove the program and restore the PC's interrupt vectors and memory allocation to the same state as before the program was loaded. Using these programs, you can have the TSR programs you need loaded only when you need them and maximise your free memory in situations when you don't. INSTALL and REMOVE can be used to manager one program, a group of programs or even several sets of programs that can be removed or reloaded in stages. Format ------ INSTALL [groupname] and, subsequently, REMOVE Remarks ------- The optional groupname parameter may be the actual name of a TSR utility (or several such names, up to 119 characters) or it may be any convenient name for a group of such programs. All memory-resident programs loaded after invoking INSTALL will treated by REMOVE as a group until INSTALL is run a second time. To be able to REMOVE such utilities individually, run INSTALL just before each separate utility is loaded. Example ------- An AUTOEXEC.BAT file might contain the following lines: INSTALL TIMEKEY TIMEKEY INSTALL FREEZE FREEZE INSTALL SUPERKEY SIDEKICK KEY SK After booting up, entering REMOVE at the DOS prompt would then produce the following display: Number of installations: 3 TIMEKEY FREEZE SUPERKEY SIDEKICK Press ENTER to remove, ESC to abort Pressing Enter would remove Superkey and SideKick. Subsequent calls to REMOVE would be needed to eliminate first FREEZE and then TIMEKEY. Note that TSRs must always be removed in reverse order of loading. INSTALL uses 1600 bytes of memory each time it is invoked. A maximum of 32 TSR groups can be INSTALLed. In the unlikely event that a "Deinstallation failed" warning appears, you should reboot as a memory allocation error may have occurred. @@KEY-FAKE KEY-FAKE Charles Petzold Simulates keystrokes Version 1.0 ------------------------------------------------------- Purpose ------- Supplies the series of keystrokes needed to initialise an application program on boot-up. Format ------ KEY-FAKE ["xyz"] [nn] [0] [@F] PROGNAME Characters typed within a pair of single or double quotes ("xyz") are normal ASCII-character keystrokes. Numbers (nn) not in quote marks are ASCII decimal codes, e.g., 13 (Enter), 26 (Ctrl-Z), or 27 (Esc). Numbers preceded by @ are the extended ASCII decimal codes (128 through 255) generated by the Alt keys, cursor keys, Ins and Del keys, and the Function keys (e.g. @61 is the F3 keystroke). The 0 is used with programs that check the keyboard buffer (it tells such programs the buffer is clear, so the programs will treat the succeeding keystroke separately). Remarks ------- KEY-FAKE is of greatest use in batch files used to call up application programs. For example, to enter Lotus's 1-2-3 and set it for File Retrieve, the following .BAT file would be appropriate: CD \LOTUS KEY-FAKE 0 13 0 13 0 13 0 13 0 13 "/FR" LOTUS This takes you past the necessary initial carriage returns and /FR command without having to type them in each time. Similarly, if each time you enter BASICA you want to have a blue border, blue background, and yellow letters, you would create a batch file, B.BAT, containing the lines KEY-FAKE "COLOUR 14,1,1" 13 "CLS" 13 BASICA Notes ----- 1. The keystroke sequence stored by KEYFAKE is limited to 124 characters and must be on one continuous command line. Keystrokes not supported by PC BIOS (e.g., Alt-Home) cannot be stored. 2. Programs such as XyWrite II that get keyboard information directly from the hardware keyboard interrupt will bypass KEY-FAKE. KEY-FAKE will also not work well when you are on-line using a communications program. 3. KEY-FAKE is memory resident, but can be executed multiple times in the same session without reloading. However, if nested batch files cause it to be re-invoked before its initially stored keystroke sequence has been exhausted, the remaining initial keystrokes will be lost. @@LITES LITES Jeff Prosise Display RS232 status Version 1.1 ------------------------------------------------------- Purpose ------- Replaces an RS232 breakout box by displaying the status of the DTR, DSR, RTS, CTS, DCD, and RI pins; also indicates the data rate, parity, number of data bits, and number of stop bits of the serial port being monitored. Format ------ LITES [comport] [U] Remarks ------- LITES is a memory-resident utility and may be loaded either at the DOS prompt or as part of an AUTOEXEC.BAT file. If no communications port is specified, the default comport monitored is COM1. After loading, alternately pressing Alt-L (the default hotkey) pops up and cancels the on-screen display, which is located (by default) in the upper right corner of the screen. LITES can be deinstalled by entering it with the optional u (or U) parameter, which simplifies changing the comport to be monitored. (Do not precede the U with a slash.) @@PRN2FILE PRN2FILE Tom Kihlken Capture printer output to a file Version 1.0 ------------------------------------------------------- Purpose ------- Captures any output nominally directed to a printer to a file that can then be edited by a word processor or printed later. Format ------ PRN2FILE [d:][path]filename [/Pn] [/Bn] [/U] Remarks ------- PRN2FILE is a memory resident program that is normally loaded as part of your AUTOEXEC.BAT file. It should be installed before other print utilities, such as a print spooler or the DOS MODE command. Once installed, the program may be run multiple times to change the filename (the drive and path default to the current directory unless specified) designated to receive the printer output. Unless the filename is changed, successive print operations are appended to (rather than overwrite) the created file. To disable the printer output redirection, simply omit to specify a filename. The optional /Pn parameter designates the printer number (the default is LPT1) to be redirected. Note that output to a non-existent printer (/P2 in a one-printer system) is supported. This is another way to permit normal printing while PRN2FILE remains resident. Legal values for Pn range from 1 through 3. The optional /Bn parameter sets the buffer size. The default value is 4096 bytes, and values up to 64K may be specified. The buffer repeatedly empties when partially full in order to minimize the chance of buffer overflow even when DOS may be called on for other activities than writing the buffer to disk. Should buffer overflow occur an error message is produced, but some data will be lost, so the file should be re-written using a larger buffer. The optional /U parameter is used to unload PRN2FILE from memory. If other memory-resident utilities have been loaded after PRN2FILE and have chained onto the same interrupts, it will not be possible to unload the program, and a message to this effect will be displayed. All optional parameters may be entered in any order, but must each be separated by a single space character that acts as a delimiter. @@PRUNE PRUNE Michael J. Mefford Sub-directory manager Version 1.0 ------------------------------------------------------- Purpose ------- To organize a hard disk by renaming, removing, copying, and moving entire directories, together with their files and subdirectories. Directories may be put into other locations on their current or on another drive's directory tree. PRUNE also reports directory or branch size and permits directly calling up PC Magazine's DR and DIRMATCH utilities to inspect files or update directories with current file versions. Format ------ PRUNE [d:] [d:] Remarks ------- Entered at the DOS prompt without either of its two optional (d:) drive arguments, PRUNE displays a graphic directory tree of the current drive in both of its side-by-side windows. The d: arguments permit initial display of any one or two directory trees on the system. The active window, which has the highlight bar, can be toggled with the Tab key or with the Left- or Right-Arrow keys. The directory tree can be traversed with the Up-/Down-Arrow, PgUp/PgDn, and Home/End keys. Esc exits the utility. The operations PRUNE can perform on the highlighted directory are executed with the Function Keys. Note that except for the Rename Directory command (F3), "directory" here includes all directory and subdirectory files. Prompts and confirmatory warnings are provided as needed. F1 copies the highlighted directory to another location on the current tree or to one highlighted in the alternate window. F2 removes a directory, and should be used with special care. F4 moves (copies, then removes the original) a directory. F5 gives the size of a directory branch, including subdirectories, in terms of the bytes allocated to the clusters required. Although PRUNE will not copy or move directories where insufficient space exists, this information may be useful in deciding which directories to work on. F6 displays the same information for the directory files without including any subdirectories. F7 permits loading and displaying the tree of a new drive. F8 calls up the DR utility to permit reading the files in a directory, and F9 calls up DIRMATCH to permit updating a target directory with file versions from a more recent directory. Note that for F8 and F9 to work, these utilities must be on the DOS path. If using a floppy drive, COMMAND.COM must also be on it. Black and white display ----------------------- Some systems, especially laptops, do not display colour contrasts very well. If you find PRUNE hard to read, you can force it to use black and white attributes by entering the command MODE BW80 before running the program. The best way to do this is from a batch file containing the lines MODE BW80 PRUNE %1 %2 If you have a colour system and PRUNE is using black and white attributes, some other application may have changed the video mode. To encourage PRUNE to use colour, issue the DOS command MODE CO80 before running the program. Customising PRUNE ----------------- The following instructions will enable you to customise the colours used by PRUNE and to change the program run by pressing F7 DR. Start by making a back-up copy of PRUNE.COM and then enter: DEBUG PRUNE.COM You are now ready to modify the utility. If at any time you make a mistake, simply abort the editing process by entering Q. The last two commands that you enter after entering any modifications are W Q for Write to disk and to Quit DEBUG. Colour scheme: Enter the following DEBUG instructions, replacing the xx with a hexadecimal colour value. The default colour values and their descriptions are shown as comments to the right of the semicolons. Do not type in the comments. E 17B xx ; 71 Blue on light gray Menu colour E 17C xx ; 17 Light gray on blue Inactive tree E 17D xx ; 31 Blue on cyan Menu bar E 17E xx ; 1F White on blue Active tree E 17F xx ; 17 Light gray on blue DR colour Alternate colours may be selected from the following list. The background colour number is entered for the first x and the foreground colour for the second x. Do not use a light colour for the background or the display will blink. Dark colours Light colours ------------ ------------- Black 0 Dark Gray 8 Blue 1 Lt Blue 9 Green 2 Lt Green A Cyan 3 Lt Cyan B Red 4 Orange C Magenta 5 Violet D Brown 6 Yellow E Lt Gray 7 White F For example, to change the bar colour from blue on cyan (31) to blue on light gray (17) you would enter E 57A 17 PRUNE turns on the border, and some monitors can't handle that. To disable the border, enter E 185 1 g Replace the 1 with a 0 to re-enable the border. Reprogramming F7: Pressing F7 in PRUNE will run the DR.COM utility if it is found on your DOS PATH. To substitute a different utility for DR, enter E 192 "12345678" where 12345678 is the eight-character name of the utility you want to use instead. Make sure to include the quotes shown above, but do NOT add either the period or the extension (.COM or .EXE) of the alternative utility. Append spaces if the utility name is less than eight characters. For example, if you have a program named DirMagic you could enter E 192 "DIRMAGIC" The DR next to the F7 in the menu will not change, but DirMagic will be executed all the same. Remember that the new utility has to be in the DOS PATH. To change the F7 utility back to DR, enter E 192 "DR " Finish the DEBUG session with W Q @@SETUP2 SETUP2 Jeff Prosise Pop-up printer configuration program Version 2.0 ------------------------------------------------------- Purpose ------- Sends menu-selected or typed control codes to a printer from within an application or from the DOS prompt. The codes can be used to configure the printer, select type faces or styles, paper trays and so forth. Format ------ SETUP2 [d:][path][filename] | [/C codes] | [/U] Remarks ------- Entered without the /C option, SETUP2 becomes a RAM resident utility with a pop-up menu of user configured printer control sequences specified in the file given by filename. The default hotkey is Ctrl-Right Shift. Esc closes the menu window and returns to any already running application. Entering SETUP2 with the /U option uninstalls the utility if no subsequent TSR program has been loaded. Any ASCII text editor or word processor can be used to create the configuration file, which contains the desired printer commands. This file may be up to 64K in size and may contain any number of lines, each of which must be ended by pressing Enter. The first line identifies the printer or company (hit Enter alone to leave it blank), and may be up to 26 characters long. Subsequent lines consist of up to 20 characters of identifying ASCII text, followed by a semicolon, followed by up to 255 bytes containing the printer control sequence. For example, the first four lines of a file for an H-P LaserJet might be: H-P LASERJET Spreadsheet; 27,"&l1o2e5.647c66F",27,"&k2S" Reset Printer; 27,"E" Form Feed; 12 ASCII 27 is the (decimal) escape character; it could alternatively be entered in hexadecimal notation as x1B or 0x1B, following the C-language style. Numeric entries may be separated by commas (as shown), or by spaces or tabs. Literal ASCII text must be enclosed either within double quotes (as shown) or single quotes. White space to the right of the semicolon is ignored, and any line in filename beginning with a pound sign (#) is treated as a comment line and will not appear in the SETUP2 window. In the example above, when the SETUP2 menu is popped up with Ctrl-Right Shift, the words "Spreadsheet," "Reset Printer," and "Form Feed" will appear next to lines identified as F1, F2, and F3. The associated printer control codes do not appear in the on-screen menu, but are sent to the printer either by pressing the indicated function key or by moving the menu highlight bar to the appropriate line with the Up- and Down-Arrow keys and pressing Enter. The PgDn and PgUp keys bring lines beyond the first "page" (ten lines) into the menu window. Below F10 in the SETUP2 menu is a blank line that may be used to send printer control sequences not contained in filename. This line is accessed by pressing the Slash key (/), typing in the actual control codes (using the format conventions previously discussed), and pressing Enter. In this case, the actual printer codes are shown on the screen; the entry line scrolls horizontally to accommodate sequences of more than 100 characters. Entering SETUP2 with the /C option enables sending printer control codes from the DOS command line without making the utility RAM-resident. This is useful both for testing and for batch file operations. The codes are again entered with the numeric and quotemark conventions previously indicated. Note that each line must end with an ASCII 13,10 (carriage return/line feed) sequence. By default, SETUP2 uses LPT1. Users familiar with DEBUG can change the entry at offset 018A (normally 0) to 1 (for LPT2) or to 2 (for LPT3). Similarly, the default Ctrl-Right Shift hotkey can be changed to another shifting key combination by changing the entry at offset 01B3 (normally 5). A hex value of C in this location would change the hotkey to Ctrl-Alt, for example. A sample file with the menu entries and codes for many Epson compatible dot-matrix printers is shown below: #============================================ # Epson RX/FX-80 Printer Make File # Copyright (c) 1989 Ziff Communications Co. #============================================ EPSON RX/FX-80 PRINTER Compressed Mode On; 15 Compressed Mode Off; 18 Expanded Mode On; 27,"W1" Expanded Mode Off; 27,"W0" Emphasized Mode On; 27,"E" Emphasized Mode Off; 27,"F" Double-Strike On; 27,"G" Double-Strike Off; 27,"H" Miniature Mode On; 15,27,83,0,27,65,6 Miniature Mode Off; 18,27,84,27,50 #-------------------------------------------- Elite Mode On; 27,"M" Elite Mode Off; 27,"P" Skip Perforation On; 27,78,8 Skip Perforation Off; 27,79 1/8" Line Spacing; 27,"0" 7/72" Line Spacing; 27,"1" 1/6" Line Spacing; 27,"2" Line Feed; 10 Form Feed; 12 Reset Printer; 27,"@" A similar sample for LaserJet printers is: #============================================ # HP LaserJet Printer Make File # Copyright (c) 1989 Ziff Communications Co. #============================================ HEWLETT-PACKARD LASERJET Portrait Mode; 27,"&l0O" Landscape Mode; 27,"&l1O" 10 Pitch; 27,"&k0S" 12 Pitch; 27,"&k4S" 16.66 Pitch; 27,"&k2S" Light; 27,"(s-3B" Medium; 27,"(s0B" Bold; 27,"(s3B" Form Feed; 12 Reset Printer; 27,"E" #-------------------------------------------- Line Printer; 27,"(s0T" Pica; 27,"(s1T" Elite; 27,"(s2T" Courier; 27,"(s3T" Helvetica; 27,"(s4T" Times Roman; 27,"(s5T" Gothic; 27,"(s6T" Spreadsheet; 27,"&l1o2e5.647c66F",27,"&k2S" These two sample files are included with SETUP2.COM, called HP and EPSON. If you have an Epson-compatible dot-matrix printer, you can try SETUP2 with the command: SETUP2 EPSON followed by pressing Ctrl and Right-shift to pop-up the program. If you have an HP Laserjet or compatible printer, enter SETUP2 HP @@SLICE SLICE Bob Flanders and Michael Holmes Split a large file over multiple floppies Version 1.2 ------------------------------------------------------- Purpose ------- Spreads a DOS file too large to be copied onto a single floppy disk across multiple diskettes, enabling the file to be restored onto a second machine. Format ------ SLICE [d:][path]filename[.ext] d: Remarks ------- The filename of the file to be divided may be preceded with a drive and/or path, if needed. The target drive may be any drive that DOS recognizes as a removable medium. Diskettes from 160KB to 1.44MB capacity may be used, as may disk cartridges whose device driver identifies them as employing a removable medium. As each target diskette is filled, the user is prompted to insert a fresh one; up to 99 formatted target disks may be accommodated. On the first of these, SLICE also creates a short (approximately 1KB) program, SPLICE.COM, which is subsequently used to reassemble the separate sections into which filename has been broken. The syntax for SPLICE.COM is: Format ------ d:\SPLICE s: [t:][path] [/R] Remarks ------- The d: parameter designates the drive on which SPLICE.COM has been written, and s: designates the source drive. Normally, these are the same. The optional t: and path identify the hard disk/path onto which the file is to be reassembled as single entity. If these latter parameters are unspecified, the default drive and directory will be used for restoration. The original filename cannot be changed in either the SLICE or SPLICE operations, each of which requires approximately 34KB of available memory. The optional /R parameter tells the program to disable the check for removable media. If you receive an error message saying, "Must be removable media," you can try running SPLICE with the /R parameter. This is useful when the device driver for a drive does not support the IOCTL requesting removable status. Note ---- The DOS BACKUP and RESTORE utilities also permit a large file to be divided among multiple disks. However, they are not as easy to use and require that the same version of DOS be present on both the originating and the receiving machines. @@SMOOTH SMOOTH Michael J. Mefford Smooth scrolling text file viewer Version 1.0 ------------------------------------------------------- Purpose ------- An EGA or VGA text-browsing utility that makes reading from the screen easier by providing smooth scrolling in either direction at user-selectable speeds. SMOOTH uses the hardware smooth scrolling ability of an EGA or VGA type display and will not work with other types. Format ------ SMOOTH filespec [/W][/Snn][Cmmm] Remarks ------- The filespec entered with SMOOTH is a filename plus any required drive and path information. The optional /W switch strips the "high bit" from WordStar document files. The optional /Snn switch sets the scrolling speed, where nn is a decimal number that represents twice the number of pixel rows to be scanned on each screen refresh cycle. The default value for nn is 3. For comparative purposes, the DOS TYPE command used with an EGA (14 pixel rows per character) would have an nn of 28. The optional /Cmmm sets the foreground and background colours according to: mmm = Foreground colour + (Background colour * 16) The foreground and background colour numbers are given in the BASIC manual under the heading, Colour statement. The default is 23 (white letters on a blue background). The up-arrow and down-arrows set the scrolling direction, and PgUp and PgDn flip a screen page. The Home and End keys go directly to the top and bottom of the file. Pressing the space bar (or the numeral 0) freezes the screen, which can be restarted by pressing any key. Hitting Esc cancels SMOOTH and returns to DOS. Pressing the plus and minus keys speeds up or slows down the scroll rate, as does pressing the number keys. Note ----- As SMOOTH manipulates the EGA/VGA controller registers directly, it is incompatible with operation of the Print Screen (PrtSc) key and with many pop-up programs, such as SideKick. @@SNIPPER SNIPPER Tom Kihlken Cut-and-paste from screen Version 1.2 ------------------------------------------------------- Purpose ------- A memory-resident program that will copies any portion of a text screen display to a printer or file, SNIPPER can also be used to 'copy' data from the screen in one program and 'paste' it into a document in another. Format ------ [d:][path]SNIPPER [rows,columns] Remarks ------- SNIPPER is a memory-resident program that is normally loaded as part of your AUTOEXEC.BAT file. The rows,columns parameter is required for EGA/VGA displays with more than the normal 25 rows and 80 columns. The default 'hotkey' is Alt-W. Pressing Esc returns you to your application. When SNIPPER is popped up, it creates its own cursor, which is moved by the normal arrow keys. To create the window of interest, press Enter to anchor the upper-left corner. The cursor keys then open and size the window, which appears in reverse video. It is not necessary to press Enter again to anchor the lower right corner. Doing so, indeed, will pop up a help menu showing the options described below. When the desired area is shown, pressing P dumps its contents to your printer, adding carriage return/line feed characters at the end of each line. SNIPPER then automatically terminates. Pressing F with the window open prompts for a filename, which may include drive and path. If no filename is entered, SCREEN.CUT is used as a default. Pressing Enter writes the marked screen contents to the file. SNIPPER then terminates, but remembers the filename. Successive saves to the same filename are appended, and so do not overwrite that file. Pressing S while a portion of the screen is marked saves the window contents to an internal buffer. Another applications program can then be called up and its cursor positioned at the point where the saved window contents should be inserted. Alt-W then activates SNIPPER, and G gets its stored contents and dumps them into the keyboard buffer as if they had been typed in by hand. Note that G must be the first SNIPPER command used in this case (any other erases its internal, stored buffer). Note, too, that G can be used without S to reenter marked material (e.g. a complex DOS command sequence) on the same screen page. Customising SNIPPER ------------------- The default hotkey for SNIPPER can be changed with DEBUG, as shown below: DEBUG SNIPPER.COM E 56B SS ;Scan code E 57B MM ;Shift mask W Q See the 'Tech Notes' document for details of scan codes and shift masks.