@echo off
setlocal enabledelayedexpansion
:menu
cls
echo ===================================================
echo               SELECT A TIME INTERVAL
echo ===================================================
echo  1] 15 Minutes
echo  2] 30 Minutes
echo  3] 60 Minutes (1 hour)
echo  4] 120 Minutes (2 hours)
echo  5] 240 Minutes (4 hours)
echo  6] 480 Minutes (8 hours)
echo  7] Custom Number
echo  8] Exit
echo ===================================================
echo.

choice /c 12345678 /n /m "Enter your choice (1-8): "

if errorlevel 8 exit
if errorlevel 7 goto custom
if errorlevel 6 set "minutes=480" & goto success
if errorlevel 5 set "minutes=240" & goto success
if errorlevel 4 set "minutes=120" & goto success
if errorlevel 3 set "minutes=60" & goto success
if errorlevel 2 set "minutes=30" & goto success
if errorlevel 1 set "minutes=15" & goto success

:custom
echo.
set /p "custom_val=Enter custom number of minutes: "


:: Validate that the input is a positive integer
echo !custom_val!| findstr /r "^[0-9][0-9]*$" >nul
if errorlevel 1 (
    echo.
    echo Error: Please enter a valid whole number.
    pause
    goto menu
)

set "minutes=%custom_val%"
goto success

:success

:: Extract parts of the date (U.S. format: DayOfWeek MM/DD/YYYY)
set "today=%date%"
set "yyyy=%today:~10,4%"
set "mm=%today:~4,2%"
set "dd=%today:~7,2%"
set "now=%time%"
set "hh=%now:~0,2%"
set "mmm=%now:~3,2%"

:: Combine into YYYY-MM-DD
::set "formatted=%yyyy%-%mm%-%dd%"

set "formatted=c:\data\%minutes%-minutes-%yyyy%-%mm%-%dd%-%hh%-%mmm%.jpg"

echo .
echo =================================================================================
echo Success! Will run AIDI tests for %minutes% minutes and output JPG to %formatted%
echo =================================================================================

if exist c:\data\aida64engineer830_portable\aida64.exe (
	c:\data\aida64engineer830_portable\aida64.exe /SST CPU,FPU,Cache,RAM,Disk,GPU /SSTDUR %minutes% /SSTSHOT %formatted%
)


