@call "%~dp0config.bat" 0 > nul
if [%~1]==[] (
  echo Aufruf: call generate.bat Beispiel.xml
  goto :eof
)

set DATEI=%XML%\%~n1.xml
set GENLOG=%TASKS%\logs\%~n1.gen.log
set TYP=Portal
echo %1 | find /I "ver" > nul 2> nul && set TYP=Versand

call teste_verzeichnis.bat %JAVA%
call teste_verzeichnis.bat %DATEI%
if errorlevel 42 exit /B 1

echo == %TYP% "%~n1" ==
%PHP%\php Tools\run.php generate duration2 %DATEI%

if exist %GENLOG% (
  taskkill.exe /F /IM pwrplay.exe 2> nul
  taskkill.exe /F /IM java.exe 2> nul
)

:webcreator
cd /d %PORTAL%\Web_MIS_Creator
echo.
echo * Erstelle Grafiken, PDF-Dateien und Scorecards
%JAVA%\java.exe -cp jacob.jar;xerces.jar;Mail.jar;GlobalCube.jar;ij.jar de.globalcube.Generate %DATEI% ALL 1> %GENLOG% 2>&1 && echo * %TYP% erstellt.
cd /d "%~dp0"

:summary
%PHP%\php Tools\run.php generate summary2 %DATEI% %TASKS%\logs\%~nx1.log
echo.
echo Fertiggestellt:    %TIME:~0,5%
echo.
goto :eof