
[system]
IniProg=CmdTwain
IniVer=1

[usage]
.CmdTwain [-q] -c "scanner settings" outfmt [path\]file
.CmdTwain [-q] -f paramfile
.CmdTwain [-q] legacymode
.
.Use -? for this usage message, or -help for help.
.
.-q     		quiet mode (less warnings)
.scanner settings:	A4, LETTER, 200, 300, BW, RGB, ...
.outfmt:		25, 50, 75, 100 for jpegs; bmp for bitmap files,
.       		pdf, pdf2, pdf3 for an A4, LETTER or LEGAL sized PDF.
.legacymode:	see help
.


# predefined variables
temp     = getenv(temp), eg C:\temp
ProgDir  = where CmdTwain is installed
DataDir  = the AppData CmdTwain directory
pid      = unique process id for CmdTwain
PathFnExt= fully specified output path, filename and extension
Path     = the output path, dirname(). no trailing slash
FnExt    = the output filename and extension, basename()
Fn       = the output filename without the extension (if any)
Ext      = the output extension (if any). includes '.' eg ".jpg"
PathFn   = the output path and filename, no extension
q        = -q (if -q quiet mode was on the command line), blank otherwise

[25]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2jpg" "-c 25 ""%temp%\%pid%\%Fn%*.bmp"" ""%PathFn%*%Ext%"""
RmDir "%temp%\%pid%"

[50]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2jpg" "-c 50 ""%temp%\%pid%\%Fn%*.bmp"" ""%PathFn%*%Ext%"""
RmDir "%temp%\%pid%"

[75]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2jpg" "-c 75 ""%temp%\%pid%\%Fn%*.bmp"" ""%PathFn%*%Ext%"""
RmDir "%temp%\%pid%"

[100]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2jpg" "-c 100 ""%temp%\%pid%\%Fn%*.bmp"" ""%PathFn%*%Ext%"""
RmDir "%temp%\%pid%"

[bmp]
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%Path%"" ""%Fn%.bmp"""

[75.8]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
List Files in "%temp%\%pid%" like "*.bmp" to f
i=0
While i<f.count
  fm=DirFn("%temp%\%pid%",f[i]))
  to=DirFn("%Path%",SetExt(f[i],".jpg"))
  Run 6 "%ProgDir%\cjpeg" "-greyscale -quality 75 -outfile ""%to%"" ""%fm%"""
  i=i+1
EndWhile
RmDir "%temp%\%pid%"

[png]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2png" "-c 9 ""%temp%\%pid%\%Fn%*.bmp"" ""%PathFn%*%Ext%"""
RmDir "%temp%\%pid%"

[pdf]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2jpg" "-c 75 ""%temp%\%pid%\%Fn%*.bmp"" ""%temp%\%pid%\%Fn%*.jpg"""
Run 6 "%ProgDir%\jpg2pdf" "-c ""-s1 a4"" ""%temp%\%pid%\%Fn%*.jpg"" ""%PathFn%.pdf"""
RmDir "%temp%\%pid%"

[pdf2]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2jpg" "-c 75 ""%temp%\%pid%\%Fn%*.bmp"" ""%temp%\%pid%\%Fn%*.jpg"""
Run 6 "%ProgDir%\jpg2pdf" "-c ""-s1 letter"" ""%temp%\%pid%\%Fn%*.jpg"" ""%PathFn%.pdf"""
RmDir "%temp%\%pid%"

[pdf3]
MkDir "%temp%\%pid%"
Run 4 "%ProgDir%\scan2bmps" "%q% -c ""%init%"" ""%temp%\%pid%"" ""%Fn%.bmp"""
Run 6 "%ProgDir%\bmp2jpg" "-c 75 ""%temp%\%pid%\%Fn%*.bmp"" ""%temp%\%pid%\%Fn%*.jpg"""
Run 6 "%ProgDir%\jpg2pdf" "-c ""-s1 legal"" ""%temp%\%pid%\%Fn%*.jpg"" ""%PathFn%.pdf"""
RmDir "%temp%\%pid%"

[source]
Run 4 "%ProgDir%\scan2bmps" "/source"

