A Grammar of the Archaeological Record

2. The Manual

21. Batch Files

Giorgio Buccellati – June 2010

Back to top: 21. Batch Files

21.1: Introduction

The file name may be chosen at will.

For the file to be placed on the unit computer’s desktop, the first two lines giving the drive and the change of directory command are required.

Alternatively, the batch file may be placed in the folder to which it refers (if only one directory is invoked), and a shortcut file is then placed on the desktop.

It is important that you delete old programs when you upload a new one. This is because, if you forget to update your batch file, you will keep running the old program even though the new one is on your computer.

Entries in bold underline (e.g., V18) are the ones that need to changed when first setting up the programs.

Back to top: 21. Batch Files

21.2: File Lists

[TEXT TO BE WRITTEN; ZGz05 mDP]

Back to top: 21. Batch Files

21.2.1: FILELIST

This batch file creates a list of file names with a given extension, e.g.:

H:
chdir \MZ\A\V18\G\LoRes
dir *.jpg /b /on > filelist.txt

The batch file must be in the same folder as the directory it is meant to process.

It creates a file named FILELIST.TXT, that is then used by other programs.

Further specifications may be added, and they are then specified in the name of the batch file. They are incorporated in a batch file that includes a startup call for a program, as shown below (see 21.4).

Back to top: 21. Batch Files

21.2.2: ALLFILES

Same as FILELIST, but it processes subdirectories within the folder where the batch file is placed.

dir *.* /b /on /s /w > allfiles.txt
echo off
echo.
echo Program Finished.
pause

Back to top: 21. Batch Files

21.3: Rename-J

This batch file changes all file names with .-J extension to a name with .J extension. The batch file must be placed within the I\J folder.

H:
chdir \MZ\A\A16\I\J
rename *.-j *.j

Back to top: 21. Batch Files

21.4: Startup Files

The following batch files allow the automatic starting of programs.

Certain parameters must be updated as needed. Pertinent updates are shown for each of the sample below in bold underlined.


[SAMPLE TO BE ADDED; ZGz20 mDP]

Back to top: 21. Batch Files

21.4.1: JD J1

This batch file creates the –BOOK.DEF file and invokes a second batch file that in turn invokes the program. The reason for two batch files is to allow running the JD program for different books from the same computer.

G:
copy \MZ-depot\J01.TXT \MZ-depot\-BOOK.DEF /Y
cd \MZ\A\J01\I\J
call \PA\batch\JD.BAT

Back to top: 21. Batch Files

21.4.2: JD

This batch file creates the necessary filelist for the JD suite to work, and then invokes the program.

Note that if you wish to run all the files in a given J folder, you need first to run the RENAME-J batch file.

g:
dir *.j /b /on > filelist.txt
cd \qb\qb45
qb /l /ah /h /run \pa\JD1-J08i.bas

Back to top: 21. Batch Files

21.4.3: JX

Starts indices, spreadsheets, data bases.

H:
cd \qb\qb45
qb /l /ah /h /run \pa\JD8-y01a.bas

Back to top: 21. Batch Files

21.4.4: S

This batch file directs the program to the folder determined by the –BOOK.DEF file, it then creates the necessary filelists for the S program to work, and then invokes the program.

H:
chdir "\mz\a\A14\O\I"
dir *.o /b /on > filelist.txt
chdir "\mz\a\A14\O\q"
dir *.o /b /on > filelist.txt
chdir "\mz\a\A14\O\qb"
dir *.o /b /on > filelist.txt
chdir "\mz\a\A14\O\qi"
dir *.o /b /on > filelist.txt
chdir "\mz\a\A14\O\qp"
dir *.o /b /on > filelist.txt
chdir "\mz\a\A14\O\a"
dir *.o /b /on > filelist.txt
cd \qb\qb45
qb /l /ah /h /run \pa\SA-2p.bas

Back to top: 21. Batch Files

21.4.5: A

This batch file directs the program to the folder determined by the –BOOK.DEF file, creates the appropriate filelist, and then invokes the program.

H:
chdir "\mz\a\A14\O\a"
dir *.o /b /on > flist.txt
cd \qb\qb45
qb /l /ah /h /run \pa\A-1d.bas

Back to top: 21. Batch Files

21.4.6: B

This batch file directs the program to the folder determined by the –BOOK.DEF file, creates the appropriate filelist, and then invokes the program.

z:

cd \MZ\A\J03\G\T\LoRes
dir *.jpg /b /on /W > filelist.txt

cd \MZ\A\J03\G\P\LoRes
dir *.wmf /b /on /W > filelist.txt

cd \qb\qb45
qb /l /ah /h /run \pa\B01b.bas

Back to top: 21. Batch Files

21.4.7: P

This batch file directs the program to the folder determined by the –BOOK.DEF file, creates a PT filelist in the root directory, and then invokes the program. The program distinguishes between P and T on the basis of the extension used (.WMF for the P program).

H:
cd \MZ\A\J03\G\P\LoRes
dir *.wmf /b /on > \PT-flist.txt
cd \qb\qb45
qb /l /ah /h /run \pa\PT-2a.bas

Back to top: 21. Batch Files

21.4.8: T

This batch file directs the program to the folder determined by the –BOOK.DEF file, creates PT filelist in the root directory, and then invokes the program. The program distinguishes between P and T on the basis of the extension used (.JPG for the T program).

H:
cd \MZ\A\J03\G\T\LoRes
dir *.jpg /b /on > \PT-filelist.txt
cd \qb\qb45
qb /l /ah /h /run \pa\PT-2a.bas

Back to top: 21. Batch Files

21.4.9: VWX

This batch file directs the program to the folder indicated (V16 in the example below), it creates a dummy folder TEXTxBAT which serves only to make sure the program is started with the batch file (it is then deleted by the program), it further creates the folder FILELIST, and within it the file ALLFILES.TXT, then it invokes the program.

Back to top: 21. Batch Files

21.4.10: X

This batch file must be placed in the subfolder (within the folder O) for the elements of which you want to create an index, e.g., in A16\O\F if you want to get a list of features with the stratum given for each feature.

z:
dir /b /s /on > $.txt
cd \qb\qb45
qb /l /ah /h /run \pa\X18h.bas

Back to top: 21. Batch Files

21.5: Resizing Graphic Files

Back to top: 21. Batch Files

21.5.1: A1-LoRes.BAT

  1. Place batch file within folder (as an example, we will use \MZ\A\A1\G\T);
  2. run batch file. It places low resolution files within \MZ\A\A1\G\T\LoRes;
  3. place all files that have been processed within subfolder \MZ\A\A1\G\T\processed, so that they will not be processed again the next time you use the batch file.
"C:\Program Files\2JPEG\2JPEG.exe"
s="H:\MZ\A\A1\G\T\HiRes\*.*"
d="H:\MZ\A\A1\G\T\LoRes\"
-namegen="L_[name].[ext]" -w1024 -h1024 -dpiver72
-dpihor72

-prop -sm1 -cd24 -q=50 -sf -ov -log -imginfo –keepexif

Back to top: 21. Batch Files

21.5.2: A1-TN.BAT

"C:\Program Files\2JPEG\2JPEG.exe"
s="H:\MZ\A\A1\G\T\HiRes\*.*"
 d="H:\MZ\A\A1\G\T\TN\" -namegen="T_[name].[ext]" -w150

-h150
 -prop -sm1 -cd24 -q=65 -sf -ov -log -imginfo

Back to top: 21. Batch Files