@ECHO OFF
SETLOCAL

IF NOT EXIST testOut\ mkdir testOut

SET PROG=tclsh ..\poApps.tcl
IF NOT "%1"=="" SET PROG=%1

SET OPT=--office --nosaveonexit --config ConfigDir --verbose --batch
SET DIR=testIn
SET OFFDIR=testIn\OfficeFormats

ECHO %PROG% %OPT% %OFFDIR%\CawtManual.docx --checklink --hidewindow
CALL %PROG% %OPT% %OFFDIR%\CawtManual.docx --checklink --hidewindow
IF NOT "%ERRORLEVEL%"=="0" ECHO ErrorCode correct file: %ERRORLEVEL%

ECHO %PROG% %OPT% %OFFDIR%\CawtManual-InvalidLinks.docx --checklink
CALL %PROG% %OPT% %OFFDIR%\CawtManual-InvalidLinks.docx --checklink
IF NOT "%ERRORLEVEL%"=="1" ECHO ErrorCode invalid file links: %ERRORLEVEL%

ECHO %PROG% %OPT% %OFFDIR%\CawtManual.docx --checkabbr Abbreviations
CALL %PROG% %OPT% %OFFDIR%\CawtManual.docx --checkabbr Abbreviations
IF NOT "%ERRORLEVEL%"=="0" ECHO ErrorCode correct file: %ERRORLEVEL%

ECHO %PROG% %OPT% %OFFDIR%\CawtManual-WrongAbbr.docx --checkabbr Abbreviations --hidewindow
CALL %PROG% %OPT% %OFFDIR%\CawtManual-WrongAbbr.docx --checkabbr Abbreviations --hidewindow
IF NOT "%ERRORLEVEL%"=="1" ECHO ErrorCode wrong file abbreviations: %ERRORLEVEL%

