@echo off
:: TV Slideshow - Generate slides.js
:: Run this after adding/removing slides

cd /d "S:\DT\tv"

:: Generate slides.js from image files in slides subfolder
echo var SLIDES = [ > slides.js
setlocal enabledelayedexpansion
set first=1
for /f "tokens=*" %%F in ('dir /b /on slides\*.jpg slides\*.jpeg slides\*.png slides\*.gif slides\*.bmp slides\*.webp 2^>nul') do (
    if !first!==1 (
        echo     "slides/%%F" >> slides.js
        set first=0
    ) else (
        echo     ,"slides/%%F" >> slides.js
    )
)
endlocal
echo ]; >> slides.js

echo Updated slides.js
pause
