bat * VCOPY - demonstration of the READSCRN command for 80 col display *
bat * Written 1/25/83
bat * Copyright 1983 by Frank Canova and Seaware Corp.


bat * Make sure that we know where data is traveling from/to
bat	TYPE
bat	READ Enter the wild card spec for files to be copied. (Press enter for all) %3
bat	TYPE
bat -rd.1 INKEY Which drive is the "from" diskette? (A, B, C, or D) %4
bat	CALL -chker | %1 = %4 | IF .%4 = . GOTO -rd.1
bat -rd.2 INKEY Which drive is the "to"   diskette? (A, B, C, or D) %4
bat	CALL -chker | %2 = %4 | IF .%4 = . GOTO -rd.2


bat * Get a directory of "from" to start asking questions about.
bat	CLS
DIR	%1:%3/w
bat

bat	STACK.ON	| * Make sure another program didn't set this off
bat	* Ignore the return to BAT
bat -ignore READSCRN %k | if .%k = . goto -ignore
bat	* Get the number of files from the screen
bat -ignore2 READSCRN %k | if .%k = . goto -ignore2


bat * Verify that have something to copy.
bat	IF %K = file type no files are available to copy. | exit
bat	IF %K = 0 type no files are available to copy. | exit


bat * Get upto 5 file names on each line.
bat -read.dline READSCRN %A %B %C %D %E %F %G %H %I %J
bat	IF %R = 2 GOTO -query	| * If at top of screen, ignore orig DIR cmd.


bat * Save on the keyboard stack all the file names if they exist.
bat	IF .%A <> . STACK %A.%B
bat	IF .%C <> . STACK %C.%D
bat	IF .%E <> . STACK %E.%F
bat	IF .%G <> . STACK %G.%H
bat	IF .%I <> . STACK %I.%J
bat	GOTO -read.dline


bat -query CLS TYPE %k files found for copy from %1: to %2:
bat	TYPE
bat -q.loop READ %f		|* Read file name off of stack
bat -q.loop2 TYPE Copy %F ? ;
bat	INKEY %A		|* Does user want to copy this one?
bat	IF %a = y TYPE Yes | SKIP 2
bat	IF %a = n TYPE No  | SKIP 2
bat	BEEP GOTO -q.loop2
bat -q.loop.y STACK copy %1:%F %2: |* Stack the COPY command for DOS later.
bat -q.loop.n  %k = %K - 1
bat	IF %K <> 0 GOTO -q.loop

bat * Remove any other messages that DOS might have put on the directory
bat * which might have gotten stacked during the READSCRN above.
bat -clean.stack
bat	IF %q = k SKIP 3
bat	READ %A %B %C
bat	IF %A <> copy GOTO -clean.stack
bat	STACK %a %b %c


bat * Verify that user is ready. DOS will pull the copy commands off of the
bat * keyboard stack after this program ends.
bat	TYPE
bat	INKEY Ready to copy. Press any key when ready . . .
bat	EXIT


bat * This is a subroutine which checks the drive spec for validity.
bat -chker
bat	%5 = %4 # | IF %5 = 1 TYPE %4
bat	IF %4 = A SKIP 4
bat	IF %4 = B SKIP 3
bat	IF %4 = C SKIP 2
bat	IF %4 = D SKIP 1
bat	BEEP
bat -chk.ok RETURN

