@echo off
REM ============================================================
REM  KIOSK UJIAN ONLINE - SUBDOMAIN ACAK (SULIT DITEBAK)
REM  Windows 7 / 10 / 11 - Edge dulu, kalau tidak ada pakai Chrome
REM  Buka https://i3wp8yi6hh09.sman2kandangan.sch.id fullscreen kiosk
REM  Subdomain ini dibuat di Cloudflare Tunnel (dashboard),
REM  servicenya sama dengan exam.sman2kandangan.sch.id.
REM  Mode kiosk: TIDAK ada address bar, tab, atau menu.
REM  Murid hanya melihat halaman ujian, alamat tidak terlihat.
REM  Keluar kiosk: Alt+F4 (guru saja)
REM
REM  PENTING: alamat tertulis di dalam file ini (baris set "URL=").
REM  Simpan file ini di flashdisk / folder guru, JANGAN di Desktop
REM  atau folder yang bisa dibuka murid.
REM ============================================================
setlocal
set "URL=https://i3wp8yi6hh09.sman2kandangan.sch.id"

REM --- Matikan browser lama supaya kiosk bersih ---
taskkill /F /IM msedge.exe >nul 2>&1
taskkill /F /IM chrome.exe >nul 2>&1
taskkill /F /IM iexplore.exe >nul 2>&1
timeout /t 2 /nobreak >nul

REM --- 1. Edge Chromium (bawaan Win 10/11, paling disarankan) ---
if exist "%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe" (
  start "" "%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe" --kiosk %URL% --edge-kiosk-type=fullscreen --inprivate --disable-save-password-bubble --no-first-run --noerrdialogs
  exit /b
)
if exist "%ProgramFiles%\Microsoft\Edge\Application\msedge.exe" (
  start "" "%ProgramFiles%\Microsoft\Edge\Application\msedge.exe" --kiosk %URL% --edge-kiosk-type=fullscreen --inprivate --disable-save-password-bubble --no-first-run --noerrdialogs
  exit /b
)

REM --- 2. Chrome (Program Files) ---
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
)

REM --- 3. Chrome instalasi per-user (sering di Win 7) ---
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
)

REM --- 4. Internet Explorer fallback (Win 7, terakhir) ---
if exist "%ProgramFiles%\Internet Explorer\iexplore.exe" (
  start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" -k %URL%
  exit /b
)
if exist "%ProgramFiles(x86)%\Internet Explorer\iexplore.exe" (
  start "" "%ProgramFiles(x86)%\Internet Explorer\iexplore.exe" -k %URL%
  exit /b
)

echo Browser Edge / Chrome / IE tidak ditemukan di PC ini.
echo Install Edge atau Chrome dulu, lalu jalankan lagi file ini.
pause
exit /b 1
