@ECHO ON
SET PRJ_PATH="%~1\%~2"
SET PRJ_IN_PATH="%~1\%~2\BaseInputs"
SET BASE_IN_PATH="%~3\BaseInputs"
set LOGFILE="%~1\%~2\log.txt"
@echo STARTING RUN AT %date% %time% > %LOGFILE%
M4InitialiseProject -path %1 -name %2 -nopause -uselogs -delete
if %ERRORLEVEL% NEQ 0 goto :ERROR
xcopy /s %BASE_IN_PATH% %PRJ_IN_PATH% /u /y
if %ERRORLEVEL% NEQ 0 goto :ERROR
M4FleetPollProc.exe -path %PRJ_PATH% -pols "*" -nopause -uselogs
if %ERRORLEVEL% NEQ 0 goto :ERROR 
M4BaseTraffGen.exe  -path %PRJ_PATH% -nopause -uselogs 
if %ERRORLEVEL% NEQ 0 goto :ERROR
M4RegTimeGen.exe    -path %PRJ_PATH% -nopause -uselogs 
if %ERRORLEVEL% NEQ 0 goto :ERROR
M4RegTraffGen.exe   -path %PRJ_PATH% -nopause -uselogs 
if %ERRORLEVEL% NEQ 0 goto :ERROR
M4RegPollProc.exe   -path %PRJ_PATH% -pols "*" -nopause -uselogs 
if %ERRORLEVEL% NEQ 0 goto :ERROR
M4RegPostProc.exe   -path %PRJ_PATH% -adms -speedflow -nopause -uselogs -dumplinks -dumpnodes -dumpbounds -connectors -aspolys 
if %ERRORLEVEL% NEQ 0 goto :ERROR
@echo ENDING RUN AT %date% %time% >> %LOGFILE%
@ECHO OFF
EXIT /B 0

:ERROR
@echo ERROR RUN FAILED AT %date% %time% >> %LOGFILE%
EXIT /B 1 


