@echo off
REM ============================================================
REM  KIOSK CBT - GOOGLE CHROME (Windows 7 / 10 / 11)
REM  Pakai ini kalau Chrome sudah terinstall di client
REM  Buka http://192.168.100.14 fullscreen mode kiosk
REM  Taruh file ini di shell:startup
REM  Keluar kiosk: Alt+F4
REM  Catatan Win 7: Chrome terakhir yang support Win 7 adalah v109
REM ============================================================
setlocal
set "URL=http://192.168.100.14"

REM --- Tunggu server CBT nyala (maks ~60 detik) ---
set /a TRY=0
:CEK_SERVER
ping -n 1 -w 1000 192.168.100.14 | find "TTL=" >nul
if not errorlevel 1 goto SERVER_OK
set /a TRY+=1
if %TRY% GEQ 20 goto SERVER_OK
timeout /t 3 /nobreak >nul
goto CEK_SERVER
:SERVER_OK

taskkill /F /IM chrome.exe >nul 2>&1
timeout /t 2 /nobreak >nul

if exist "%ProgramFiles%\Google\Chrome\Application\chrome.exe" (
  start "" "%ProgramFiles%\Google\Chrome\Application\chrome.exe" --kiosk %URL% --incognito --disable-save-password-bubble --no-first-run --disable-translate --noerrdialogs
  exit /b
)
if exist "%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" (
  start "" "%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" --kiosk %URL% --incognito --disable-save-password-bubble --no-first-run --disable-translate --noerrdialogs
  exit /b
)
if exist "%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe" (
  start "" "%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe" --kiosk %URL% --incognito --disable-save-password-bubble --no-first-run --disable-translate --noerrdialogs
  exit /b
)

echo Google Chrome tidak ditemukan di PC ini.
echo Pakai kiosk-auto.bat, atau install Chrome dulu.
pause
exit /b 1
