@echo off

if not defined ICEM_ACN goto ErrorScribApp

if not defined TCL_LIBRARY set TCL_LIBRARY="%ICEM_ACN%\lib\tcl8.3.3"
if not defined  TK_LIBRARY set  TK_LIBRARY="%ICEM_ACN%\lib\tk8.3.3"

if not defined ICEM_SCRIB set ICEM_SCRIB=%ICEM_ACN%\lib\scrib
rem if "%ICEM_SCRIB%" == ""   set ICEM_SCRIB="%ICEM_ACN%\lib\scrib"

if "%1" == "-batch" goto StartBatchScribApp

if not exist "%ICEM_ACN%\bin\wish.exe" goto ErrorScribNoWish

start /wait "%ICEM_ACN%\bin\wish.exe" "%ICEM_SCRIB%\app\main.tcl" app_bsm_advanced %*
goto ExitScribApp

:StartBatchScribApp
"%ICEM_ACN%\bin\tclsh" "%ICEM_SCRIB%\app\main.tcl" app_bsm_advanced %*
pause
goto ExitScribApp

:ErrorScribApp
echo Cant' run a ScripApp without ICEM_ACN set!
pause
goto ExitScribApp

:ErrorScribNoWish
echo Can't find the Wish Application!
pause
goto ExitScribApp

:ExitScribApp
