@echo off
cls

echo Pre-processing...
del temp.aptsrc
prep.exe %1.apt 1> temp.aptsrc
if %ERRORLEVEL% GTR 0 (
    echo prep.exe failed with return value %ERRORLEVEL%
    echo Check temp.aptsrc for error messages
    exit /b
    )

echo Compiling...
del clprnt.txt
apt360.exe < temp.aptsrc > clprnt.txt 2> null
if %ERRORLEVEL% GTR 0 (
    echo apt360.exe failed with return value %ERRORLEVEL%
    echo Check clprnt.txt for error messages
    exit /b
    )

echo Post-processing...
rem del %1.plt
del %1.tap
postp.exe . > %1.tap
if %ERRORLEVEL% GTR 0 (
    echo postp.exe failed with return value %ERRORLEVEL%
    echo Check clprnt.txt for error messages
    exit /b
    )

echo Success! Tape file is %1.tap

if exist %1.tap start /b plot.exe %1.tap