@echo off setlocal title Building AudioRecorder.exe... color 0A :: Always run from the folder this .bat file lives in cd /d "%~dp0" echo. echo ================================================ echo Audio Recorder - EXE Builder echo ================================================ echo Build folder: %~dp0 echo. :: Check Python python --version >nul 2>&1 if errorlevel 1 ( echo [ERROR] Python not found! echo Download from https://python.org and tick "Add to PATH" pause & exit /b 1 ) python --version echo. echo [1/4] Installing dependencies... pip install pyinstaller flask sounddevice soundfile numpy pillow pystray lameenc --quiet if errorlevel 1 ( echo [ERROR] pip install failed. pause & exit /b 1 ) echo Dependencies OK. echo. echo [2/4] Preparing source files... if not exist "src" mkdir src if exist "audio_recorder_server.py" ( copy /Y "audio_recorder_server.py" "src\audio_recorder_server.py" >nul echo Copied audio_recorder_server.py to src\ ) else ( echo [ERROR] audio_recorder_server.py not found in this folder! echo Place audio_recorder_server.py alongside BUILD.bat and try again. pause & exit /b 1 ) if not exist "src\launcher.py" ( echo [ERROR] src\launcher.py not found! pause & exit /b 1 ) echo Source files OK. echo. echo [3/4] Running PyInstaller (may take 2-3 minutes)... echo. pyinstaller "%~dp0AudioRecorder.spec" --clean --noconfirm if errorlevel 1 ( echo. echo [ERROR] PyInstaller failed. See output above. pause & exit /b 1 ) echo. echo [4/4] Done! echo. echo ================================================ echo SUCCESS: dist\AudioRecorder.exe echo ================================================ echo. echo Double-click AudioRecorder.exe to launch. echo It will appear as a system tray icon. echo Right-click the tray icon for controls. echo. if exist "dist\AudioRecorder.exe" explorer "%~dp0dist" pause