@echo off
setlocal EnableExtensions EnableDelayedExpansion

if "%~1"=="" goto help

set "INPUT=%~1"
set "EXT=%~x1"

if /I not "%EXT%"==".pptx" (
    echo [ERROR] Only .pptx supported
    pause
    exit /b 1
)

set "OUT=%~dp1%~n1_compressed.pptx"

echo [INFO] Compressing %~n1

"%~dp0pptx-image-compress.exe" -i "%INPUT%" -o "%OUT%"
set RC=%ERRORLEVEL%

if %RC% neq 0 (
    echo [ERROR] Failed (%RC%)
) else (
    echo [SUCCESS] Done
    echo Output: "%OUT%"
)

pause
exit /b %RC%

:help
echo.
echo Drag ^& Drop a .pptx file onto this script
echo.
pause