INSERT batch command makes it possible
for a calling command to verify that the required floppy disk is inserted
into specified drive. Normally initial request for specified floppy
is displayed and disk name is checked by INSERT
command. However, one of this actions, or both of them, can be bypassed,
which gives additional flexibility to the process. User has to insert
the required disk and hit [Enter] for confirmation, or hit [Esc] to cancel,
in which case a return code of "1" is passed to the calling batch.
Demo of INSERT command
operation can be found below the command text. This demonstration is
an artificial one, since INSERT command is developed
to be called from another commands. However, it gives a general idea
how INSERT command works.
Note:
Calling batch command gets return code in the "%?" variable that can
be checked by "||" for being non-zero.
: INSERT Insert Specified Disk into Floppy Drive 06/11/1994-10/15/1999
: ----------------------------------------------------------------------
: Copyright (C) 1994-1999 by Vladimir Veytsel www.davar.net
: 1. Disk drive letter (no ":")
: "?" - Display batch command text (Equivalent: "/")
: 2. Floppy disk name
: 3. Bypass specified actions:
: I - Bypass initial request
: N - Bypass disk name checking
: Notes:
: - Returns "0" in "%?" for successful insert and "1" otherwise
: - Empty value of S environment variable suppresses beep sound
: (See S.BTM for details about S environment variable)
: Example of usage: "CALL INSERT A,W-JOB,I || QUIT"
@ECHO %TR%
IF %1.==/. .OR. %1.==?. (LIST %_BATCHNAME ^ QUIT)
IF %@INDEX[%@UPPER[%3],I] GE 0 GOTO Check
:Beep
IF NOT %S%.==. BEEP 440 4 587 2 1040 6
:Ins
SET Ins=
INKEY /K"[Enter] [Esc]" %W%Insert %G%%@UPPER[%2] %W%disk into floppy drive %G%%@UPPER[%1]: %W%and hit %C%[Enter]%D% %%Ins
IF "%Ins%" NE "@28" (SET Ins= ^ QUIT 1)
SET Ins=
:Check
IFF %@READY[%@UPPER[%1]:].==0. THEN
ECHO:
ECHO %R%No disk is inserted into drive %M%%@UPPER[%1]:%D%
GOTO Beep
ENDIFF
IF %@INDEX[%@UPPER[%3],N] GE 0 .OR. %@LABEL[%@UPPER[%1]:].==%@UPPER[%2]. (SET INS= ^ QUIT 0)
ECHO:
ECHO %R%Wrong disk %M%%@LABEL[%@UPPER[%1]:] %R%is inserted instead of requested %M%%@UPPER[%2]%D%
GOTO Beep
Insert into floppy drive A: disk labelled W-JOB (initial request issued).
Fri 10/01/99 13:26 C:\> INSERT A,W-JOB
Insert W-JOB disk into floppy drive A: and hit [Enter]
Wrong disk W-IS is inserted instead of requested W-JOB
Insert W-JOB disk into floppy drive A: and hit [Enter] ^C
Cancel batch job C:\BATCH\INSERT.BTM ? (Y/N/A) :
Fri 10/01/99 20:28 C:\>
Insert into floppy drive A: disk labelled W-JOB (initial request bypassed).
Fri 10/01/99 20:25 C:\> INSERT A,W-JOB,I
Wrong disk unlabeled is inserted instead of requested W-JOB
Insert W-JOB disk into floppy drive A: and hit [Enter]
Wrong disk TEST is inserted instead of requested W-JOB
Insert W-JOB disk into floppy drive A: and hit [Enter] ^C