CALL C:\LiveDigital\config.bat

FOR /f "tokens=1-2 delims=/:" %%a IN ("%TIME%") DO (
	SET _thishour=%%a
	SET _thisminute=%%b
)

SETLOCAL EnableDelayedExpansion

TASKKILL /IM firefox.exe /F
TASKKILL /IM firefox2.exe /F
TASKKILL /IM firefox3.exe /F
TASKKILL /IM firefox4.exe /F
TASKKILL /IM firefox5.exe /F
TASKKILL /IM firefox6.exe /F

PING 127.0.0.1 -n 2 -w 500

IF %var_noscreens% GTR 1 (
	DEL "C:\Program Files\Mozilla Firefox\firefox2.exe"
	PING 127.0.0.1 -n 2 -w 500

	COPY "C:\Program Files\Mozilla Firefox\firefox.exe" "C:\Program Files\Mozilla Firefox\firefox2.exe"
	PING 127.0.0.1 -n 4 -w 500
)

IF %var_noscreens% GTR 2 (
	DEL "C:\Program Files\Mozilla Firefox\firefox3.exe"
	PING 127.0.0.1 -n 2 -w 500

	COPY "C:\Program Files\Mozilla Firefox\firefox.exe" "C:\Program Files\Mozilla Firefox\firefox3.exe"
	PING 127.0.0.1 -n 4 -w 500
)

IF %var_noscreens% GTR 3 (
	DEL "C:\Program Files\Mozilla Firefox\firefox4.exe"
	PING 127.0.0.1 -n 2 -w 500

	COPY "C:\Program Files\Mozilla Firefox\firefox.exe" "C:\Program Files\Mozilla Firefox\firefox4.exe"
	PING 127.0.0.1 -n 4 -w 500
)

IF %var_noscreens% GTR 4 (
	DEL "C:\Program Files\Mozilla Firefox\firefox5.exe"
	PING 127.0.0.1 -n 2 -w 500

	COPY "C:\Program Files\Mozilla Firefox\firefox.exe" "C:\Program Files\Mozilla Firefox\firefox5.exe"
	PING 127.0.0.1 -n 4 -w 500
)

IF %var_noscreens% GTR 5 (
	DEL "C:\Program Files\Mozilla Firefox\firefox6.exe"
	PING 127.0.0.1 -n 2 -w 500

	COPY "C:\Program Files\Mozilla Firefox\firefox.exe" "C:\Program Files\Mozilla Firefox\firefox6.exe"
	PING 127.0.0.1 -n 4 -w 500
)

TASKKILL /IM firefox.exe /F
TASKKILL /IM firefox2.exe /F
TASKKILL /IM firefox3.exe /F
TASKKILL /IM firefox4.exe /F
TASKKILL /IM firefox5.exe /F
TASKKILL /IM firefox6.exe /F

PING 127.0.0.1 -n 2 -w 500


CMDOW /RUN /MAX "C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote -P instance0 "https://addons.mozilla.org/en-us/firefox/addon/r-kiosk/" ""
PAUSE

IF %var_noscreens% GTR 1 (
	CMDOW /RUN /MAX "C:\Program Files\Mozilla Firefox\firefox2.exe" -no-remote -P instance1 "https://addons.mozilla.org/en-us/firefox/addon/r-kiosk/" ""
	PAUSE
)

IF %var_noscreens% GTR 2 (
	CMDOW /RUN /MAX "C:\Program Files\Mozilla Firefox\firefox3.exe" -no-remote -P instance2 "https://addons.mozilla.org/en-us/firefox/addon/r-kiosk/" ""
	PAUSE
)

IF %var_noscreens% GTR 3 (
	CMDOW /RUN /MAX "C:\Program Files\Mozilla Firefox\firefox4.exe" -no-remote -P instance3 "https://addons.mozilla.org/en-us/firefox/addon/r-kiosk/" ""
	PAUSE
)

IF %var_noscreens% GTR 4 (
	CMDOW /RUN /MAX "C:\Program Files\Mozilla Firefox\firefox5.exe" -no-remote -P instance4 "https://addons.mozilla.org/en-us/firefox/addon/r-kiosk/" ""
	PAUSE
)

IF %var_noscreens% GTR 5 (
	CMDOW /RUN /MAX "C:\Program Files\Mozilla Firefox\firefox6.exe" -no-remote -P instance5 "https://addons.mozilla.org/en-us/firefox/addon/r-kiosk/" ""
	PAUSE
)


EXIT