@echo off title MAPS to DXF cd /d "%~dp0" where node >nul 2>&1 if %errorlevel% neq 0 ( echo Node.js not found. Installing via Windows Package Manager... winget install OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements 2>nul if %errorlevel% neq 0 ( echo. echo Could not install Node.js automatically. Opening download page... start https://nodejs.org/ echo. echo After installing Node.js, close this window and double-click Start.bat again. pause exit /b 1 ) echo. echo Node.js installed. Please close this window, then double-click Start.bat again. pause exit /b 0 ) if not exist "node_modules" ( echo Installing dependencies... call npm install ) else if not exist "node_modules\multer" ( echo Installing missing dependencies... call npm install ) if exist "ml_server\segment_server.py" ( where python >nul 2>&1 if %errorlevel% equ 0 ( start "MAPS to DXF - ML Server" cmd /k "call %~sdp0Start_ML_Server.bat" timeout /t 2 /nobreak >nul ) else ( where py >nul 2>&1 if %errorlevel% equ 0 ( start "MAPS to DXF - ML Server" cmd /k "call %~sdp0Start_ML_Server.bat" timeout /t 2 /nobreak >nul ) ) ) echo Starting MAPS to DXF... for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":3456" ^| findstr "LISTENING"') do taskkill /PID %%a /F >nul 2>&1 echo Browser will open. Keep this window open while using the app. if exist "ml_server\segment_server.py" echo (ML server started in the other window - enable "Use server-side ML segmentation" in the app.) echo. call npm start pause