SHORTIES\IS.DOC  ·  DOC  ·  5.4 KB  ·  1989-09-06  ·  from PCPlus_Issue-39_Dec-1989-FluxEngine-360kB
                                   IS.COM
                                   ======

This is a small program designed to inform a batch file of the machine status.
Using IS with a parameter from the following list helps you to produce
quite intelligent batch files. Examples where this might be used include
software installation, automatic set-ups, intelligent copiers, etc.

   IS AT       detects whether the PC is an AT or not.

   IS MATHS    detects whether a maths co-processor is fitted.

   IS TURBO    detects whether a "Turbo" PC is in fact in "Turbo" mode or not.

   IS PRINTER  detects whether a printer is online.

   IS ANSI     detects whether DEVICE=ANSI.SYS is active, and also reports
               whether a colour or mono video card is in use.

   IS A:       detects whether there is actually a floppy disk in the A: drive;
               drives A: or B: can be tested in the same way; i.e.  IS B:

   IS VERSION  returns the DOS major version number, ie 2 for DOS 2.11,
               3 for DOS 3.2 or 3.3 etc.

   IS MEMSIZE  informs how much memory is available to DOS.

   IS EMS      indicates if EMS is present. (Actually whether int 67 is set)
               returning the number of free 16k pages.

   IS NETWORK  tells us if we're on a Microsoft network.

   IS KEY      detects a key-press, rather like BASIC's INKEY$
               note that it doesn't WAIT for a key press.

   IS REPLY    waits for a keypress, gives the alphabetic/numeric value of the
               key. 1 or A are treated as 1, similarly 2 or B return 2, etc.

   IS OK       accepts only Y or N. Beeps on any other key.

   IS DRIVES   indicates single floppy, dual floppy or if there's a hard disk.

   IS CURRENT  tells you what disk you are currently logged on to.
               (can be confused by driver.sys if used for external drive)

   IS HARD     tells you if the current disk is a hard disk.

   IS MOUSE    tells you if there is a mouse driver installed.

   IS BUTTON   waits for a mouse button-press, indicating left/right/both.

   IS EGA      tells you if the PC has an EGA (or VGA) video card.

   IS RANDOM   gives a random errorlevel of 0,1,2, or 3.

In each case the result is passed to the batch file in the form of an
"Errorlevel" which can be tested using "IF ERRORLEVEL n GOTO xxx" type
statements. Remember that errorlevels must be tested in descending order;
see your DOS manual for details, or the accompanying example batch file.

   IS          alone, gives a brief syntax reminder.

   IS HELP     gives a full list of commands and the ERRORLEVEL's returned;
               if colour and ANSI.SYS are detected, a colour header is used.

   IS NOTES    gives program hints, limitations and other details.


The tests may also be run as stand-alone's - they normally report to
the screen; you may however prefer them to operate "in silence", ie no print.
In a batch file this can be avoided by redirecting to NUL, for example:

IS AT > NUL

This would return the errorlevel found without saying anything on-screen.
*NOTE* that IS ANSI should NOT be silenced in this way; it MUST be allowed
to send control characters to the screen. IS ANSI can of course be immediately
followed by a CLS without upsetting the returned errorlevel.

Before redirecting text to the printer,  IS PRINTER  can be used to check
that it is online, & prompt the user accordingly; the example batch file
does exactly this at the printer test stage.

IS ANSI could be used to correctly install mono or colour versions of a
package as appropriate, without having to ask the user which video card he has.

Similarly  IS A: could help an unaccustomed user through an installation,
or whatever, avoiding DOS "drive not ready" errors.

IS DRIVES could automate installation in either a floppy or hard-disk system.

IS VERSION could warn a user that the software to be installed will not run
on early versions of DOS. IS MEMSIZE would be used to test for a minimum
memory size when installing larger programs.

IS KEY can be used to set up loops, to be interrupted by a key-press, whilst
IS REPLY is ideal for menus.

IS MOUSE tests for the presence of a mouse driver; if successful IS BUTTON can
provide a nice alternative to the PAUSE command in batch files, using the
mouse. Decisions may be made using Left or Right buttons to select an option.

IS RANDOM could add a little variety to your batch files; setting random
colours for example. I can't think of a use for IS TURBO; however it was
easy to add, so in it went.

Please refer to ISEXAMPL.BAT where each function is demonstrated.

Two points to note: Most Turbo PC's switch between high & low speed using
port 61 hex; however if yours doesn't, then IS TURBO won't work properly.
Secondly IS PRINTER may get confused by a Smart-switch, especially the type
that scans the inputs sequentially - it will report the status at the instant
of the test.

Finally each IS parameter may be abbreviated to a minimum of 2 characters,
thus IS PR, IS MO equate to IS PRINTER & IS MOUSE respectively. In the
interests of clarity however it is preferable to use the full form.

IS was (!) written & placed in the public domain by Phil Green, telephone
Sheffield 0742-732366. It may be freely copied for personal use but
may NOT be sold. May 1989.