@ECHO OFF
SETLOCAL
SET OUTDIR=..\

	IF NOT EXIST bin\    MD     bin\
	IF     EXIST bin\*.* DEL /Q bin\*.*

	IF NOT EXIST tmp\    MD     tmp\
	IF     EXIST tmp\*.* DEL /Q tmp\*.*

	IF EXIST %OUTDIR%SprSht.txt  DEL %OUTDIR%SprSht.txt
	IF EXIST %OUTDIR%SprSht*.bmp DEL %OUTDIR%SprSht*.bmp

r.exe RunByBat
IF ERRORLEVEL 1 EXIT /B

ufesvr.exe -a bin\
IF ERRORLEVEL 1 EXIT /B

FOR %%i IN (bin\*.bin) DO (
	ECHO %%i
	ruby split.rb %%i >> tmp\pivot.sed
	IF ERRORLEVEL 1 EXIT /B 1
)

dpsprsht.exe -p2 -r%OUTDIR% tmp\*.bmp ^
  | onigsed.exe -f tmp\pivot.sed ^
  | TabAlign.exe ^
  > %OUTDIR%SprSht.txt
IF ERRORLEVEL 1 EXIT /B 1
