@echo off

cd /d "%~dp0"

set src0=%~nx1

set Dest0=%~nx1-PNG

set python27=_exe\python.exe
set py=_exe\itp.py

set Error0=%src0%
if not exist "%Error0%" goto Error

set Error0=%python27%
if not exist "%Error0%" goto Error

set Error0=%py%
if not exist "%Error0%" goto Error



for %%f IN ("%src0%\*.itp") DO (
if not exist "%Dest0%" mkdir "%Dest0%"
if not exist "%Dest0%\%%~nxf" copy /b /y "%%f" "%Dest0%\%%~nxf">nul

echo.
echo [%%~nxf]  to  [%%~nf.png]
if not exist "itpcnv.exe" copy /b /y "_exe\itpcnv.exe">nul
"%python27%" "%py%" "%Dest0%\%%~nxf"
echo.

if exist "%Dest0%\%%~nf.png" del /q "%Dest0%\%%~nxf">nul)



goto End
:Error
echo.
echo [%Error0%] Not Found.
echo.
pause

:End
if exist "tmp" del /q "tmp">nul
if exist "tmp.itp" del /q "tmp.itp">nul
if exist "itpcnv.exe" del /q "itpcnv.exe">nul
if exist "_exe\*.pyc" del /q /s "_exe\*.pyc">nul
if exist "%Dest0%" if not exist "%Dest0%\*.*" rd /q "%Dest0%">nul
if not exist "%Dest0%\*.png" pause
rem pause
