@echo off
color 02
rem ========================================
rem PLEASE DO NOT USE del out.* 
rem ========================================
IF EXIST C:\tmp\out.dn del C:\tmp\out.dn
IF EXIST C:\tmp\out.ips del C:\tmp\out.ips
IF EXIST C:\tmp\out.itx del C:\tmp\out.itx
IF EXIST C:\tmp\out.tex del C:\tmp\out.tex
IF EXIST C:\tmp\out.txt del C:\tmp\out.txt
IF EXIST C:\tmp\out.mpx del C:\tmp\out.mpx
IF EXIST C:\tmp\out.dvi del C:\tmp\out.dvi
IF EXIST C:\tmp\out.log del C:\tmp\out.log
IF EXIST C:\tmp\out.aux del C:\tmp\out.aux

IF EXIST C:\itrans53\html\out.html del C:\itrans53\html\out.html
IF EXIST C:\LocalMiKTeX 2.6\tex\latex\itrans\compose.ips erase C:\localTeXmf\tex\latex\itrans\compose.ips
goto %1

rem ==========================================
rem              %1 = SHOW_DN
rem ==========================================

:SHOW_DN
cd\
cd LocalMiKTeX 2.6\doc\DN
copy %2.dn c:\tmp\out.dn
cd\
cd tmp
devnag out
IF NOT EXIST c:\tmp\out.tex goto ERROR
rem ----------------------------------------------------
:TRYLATEX
call LATEX out
IF NOT EXIST c:\tmp\out.dvi goto TRYTEX
goto SCAN
rem - - - - - -
:TRYTEX
call TEX out
IF NOT EXIST c:\tmp\out.dvi goto ERROR
goto SCAN
rem ===========================================
rem               %1 = SHOW_IPS
rem ===========================================

:SHOW_IPS
cd\
cd LocalMiKTeX 2.6\doc\ips
COPY %2.IPS  C:\itrans53\bin\compose.ips
cd\
cd itrans53\bin
itrans -v -P -i COMPOSE.IPS -o x.tps
COPY C:\itrans53\lib\itrans.pro+C:\itrans53\lib\fonts\devnac.ps+C:\itrans53\bin\x.tps c:\tmp\OUT.PS
erase C:\itrans53\bin\x.tps
IF NOT EXIST c:\tmp\out.ps goto ERROR
cd\
cd tmp
c:\tmp\out.ps
goto END
rem ==============================================
rem %1 = SHOW_ITX
rem ==============================================

:SHOW_ITX
cd\
cd LocalMiKTeX 2.6\doc\itx
copy %2.ITX c:\tmp\compose.itx
cd\
cd tmp
c:\itrans53\bin\itrans -i c:\tmp\compose.itx -o c:\tmp\out.tex
ERASE c:\tmp\compose.itx
cd\
cd tmp
Call LATEX out
IF NOT EXIST c:\tmp\out.dvi goto ERROR
goto SCAN
rem =============================================
rem %1 = SHOW_MyPICS
rem =============================================

:SHOW_MyPICS
cd\
cd LocalMiKTeX 2.6\doc\MyPics
copy %2.MPX c:\tmp\out.MPX
cd\
cd tmp
mathspic out.MPX out.TEX
IF NOT EXIST c:\tmp\out.tex goto ERROR
call LATEX out
IF NOT EXIST c:\tmp\out.dvi goto ERROR
goto SCAN
rem =============================================
rem            %1 = SHOW_LATEX
rem =============================================

:SHOW_LATEX
cd\
cd LocalMiKTeX 2.6\doc\latex
COPY %2.TeX  c:\tmp\OUT.TeX 
cd\
cd tmp
call LATEX out
IF NOT EXIST c:\tmp\out.dvi goto ERROR
goto SCAN
rem =============================================
rem            %1 = SHOW_TEX
rem =============================================

:SHOW_TEX
cd\
cd LocalMiKTeX 2.6\doc\tex
COPY %2.TeX  c:\tmp\OUT.TeX 
cd\
cd tmp
call TEX out
IF NOT EXIST c:\tmp\out.dvi goto ERROR
goto SCAN
rem ============================================
rem                      %1 = SHOW_TXT
rem ============================================

:SHOW_TXT
cd\
cd LocalMiKTeX 2.6\doc\Txt

copy c:\itrans53\bin\preitx+%2.TXT+c:\itrans53\bin\postitx c:\tmp\compose.itx
cd\
cd tmp
c:\itrans53\bin\itrans -i c:\tmp\compose.itx -o c:\tmp\out.tex
rem ERASE c:\tmp\compose.itx
cd\
cd tmp
Call LATEX out
IF NOT EXIST c:\tmp\out.dvi goto ERROR
goto SCAN

rem ==================================================

:SCAN
cls
echo .
echo .
echo . TO GET CORRECT VIEW OF YOUR FILE YOU MAY HAVE TO
echo . RETRY THE PROGRAM WITH OTHER AVAILABLE OPTIONS.
echo ==================================================
echo .                                                .
echo .      SELECT A FILE VIEWER FROM THE FOLLOWING   .
echo .                                                .
echo .             1. GHOSTVIEW                       .
echo .             2. ACROBAT READER                  .
echo .             3. YAP DVI VIEWER                  .
echo .                                                .
echo .             Select 1 through 3                 .
echo .                                                .
echo ==================================================
echo .
echo .
GET
IF ERRORLEVEL 27 IF NOT ERRORLEVEL 28 goto END REM ESCAPE
IF ERRORLEVEL 49 IF NOT ERRORLEVEL 50 GOTO GHOSTVIEW
IF ERRORLEVEL 50 IF NOT ERRORLEVEL 51 GOTO ACROBAT
IF ERRORLEVEL 51 IF NOT ERRORLEVEL 52 GOTO YAP
goto SCAN
rem ==================================================

:GHOSTVIEW
dvips out.dvi
"C:\Program Files\Ghostgum\gsview\gsview32.exe" out.ps
goto END
rem ==================================================

:ACROBAT
dvipdfm out.dvi
"C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" out.pdf
goto END
rem ==================================================

:YAP
yap out.dvi
goto END
rem ==================================================

:ERROR
echo ERROR!! Unable to SHOW %2 
echo see out.log file in c:\tmp
pause
goto END


rem ===================================================================
rem                      %1 = TXT2HTML
rem ===================================================================
:TXT2HTML
cd\
cd LocalMiKTeX 2.6\doc\txt
copy %2.txt c:\itrans53\bin\out.txt

copy c:\itrans53\bin\header.hdr+c:\itrans53\bin\out.TXT c:\itrans53\bin\temp.txt
rem pause This pause was for testing only.
echo ----Now deleting any temporary delatable del*.* Files -----
IF EXIST c:\itrans53\bin\del*.* del c:\itrans53\bin\del*.*
echo ------------------------------------------------------------
cd\
cd itrans53\bin
translit -i c:\itrans53\bin\Temp.txt -o c:\itrans53\bin\del1.txt -t c:\itrans53\bin\itx2iht1.tbl
translit -i c:\itrans53\bin\del1.txt -o c:\itrans53\bin\del2.txt -t c:\itrans53\bin\itx2iht2.tbl
translit -i c:\itrans53\bin\del2.txt -o c:\itrans53\bin\del3.txt -t c:\itrans53\bin\itx2iht3.tbl
copy c:\Itrans53\bin\iht.hdr+c:\itrans53\bin\del3.txt+c:\itrans53\bin\iht.trl c:\itrans53\bin\del.iht
itrans -v -i c:\itrans53\bin\del.iht -o C:\ITRANS53\HTML\out.html
goto SHOWHTML

:SHOWHTML
echo removing %1 extra files....

del c:\itrans53\bin\Temp.txt
del c:\itrans53\bin\out.txt
del c:\itrans53\bin\del*.*
rem --------------------------------------------------------------------------
rem Make sure that the path for iexplore and netscape is correct
rem --------------------------------------------------------------------------
:SCAN2
COLOR 02
echo SELECT AN INTERNET BROWSER TO DISPLAY YOUR HTML FILE
echo .
echo          1. NETSCAPE
echo          2. MicroSoft Internet Explorer
echo          3. Microsoft Winword
echo          4. EXIT WITHOUT DISPLAY
echo .
echo   Select 1 through 4

GET
IF ERRORLEVEL 27 IF NOT ERRORLEVEL 28 GOTO END        REM ESCAPE
IF ERRORLEVEL 49 IF NOT ERRORLEVEL 50 GOTO NETSCAPE   REM 1
IF ERRORLEVEL 50 IF NOT ERRORLEVEL 51 GOTO IEXPLORE   REM 2
IF ERRORLEVEL 51 IF NOT ERRORLEVEL 52 GOTO WINWORD    REM 3
IF ERRORLEVEL 52 IF NOT ERRORLEVEL 53 GOTO END        REM 4

GOTO SCAN2
rem --------------------------------------------------------------------------
:IEXPLORE
echo Now loading Internet Explorer .........
call "c:\Program Files\Internet Explorer\iexplore" "C:\itrans53\HTML\out.html"
GOTO END
rem --------------------------------------------------------------------------
:NETSCAPE
echo Netscape browser is not available on this computer.
echo I can use Internet Explorer instead.
pause
goto IEXPLORE
rem echo Now loading Netscape Browser .........
rem call "C:\Program Files\Netscape\Navigator 9\navigator.exe" "C:\itrans53\HTML\out.html"
GOTO END
REM ----------------------------------------------------------------
:WINWORD
echo Now loading MicroSoft WINWORD
call "C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\itrans53\html\out.html"
GOTO END
rem ================================================================
rem                     OTHER LANGUAGES IN HTML
rem ================================================================
rem                       %1 = TXT2BENGALI
rem ================================================================

:TXT2BENGALI
cd\
cd LocalMiKTeX 2.6\doc\txt
copy %2.txt c:\itrans53\bin\out.txt

copy c:\itrans53\bin\header.hdr+c:\itrans53\bin\out.TXT c:\itrans53\bin\temp.txt
echo ----Now deleting any temporary delatable del*.* Files -----
IF EXIST c:\itrans53\bin\del*.* del c:\itrans53\bin\del*.*
echo ------------------------------------------------------------
cd\
cd itrans53\bin
translit -i c:\itrans53\bin\Temp.txt -o c:\itrans53\bin\del1.txt -t c:\itrans53\bin\itx2iht1.tbl
translit -i c:\itrans53\bin\del1.txt -o c:\itrans53\bin\del2.txt -t c:\itrans53\bin\itx2iht2.tbl
rem  ********** Start bengali files ****************
translit -i c:\itrans53\bin\del2.txt -o c:\itrans53\bin\del3.txt -t c:\itrans53\bin\itx2ihtbeng3.tbl
copy c:\Itrans53\bin\alllangs.hdr+c:\itrans53\bin\del3.txt+c:\itrans53\bin\iht.trl c:\itrans53\bin\del.iht
rem  ********** END bengali files ******************
itrans -v -i c:\itrans53\bin\del.iht -o C:\ITRANS53\HTML\out.html
goto SHOWHTML
rem ===============================================================
rem                     %1 = TXT2GUJ
rem ===============================================================

:TXT2GUJ
cd\
cd LocalMiKTeX 2.6\doc\txt
copy %2.txt c:\itrans53\bin\out.txt

copy c:\itrans53\bin\header.hdr+c:\itrans53\bin\out.TXT c:\itrans53\bin\temp.txt
echo ----Now deleting any temporary delatable del*.* Files -----
IF EXIST c:\itrans53\bin\del*.* del c:\itrans53\bin\del*.*
echo ------------------------------------------------------------
cd\
cd itrans53\bin
translit -i c:\itrans53\bin\Temp.txt -o c:\itrans53\bin\del1.txt -t c:\itrans53\bin\itx2iht1.tbl
translit -i c:\itrans53\bin\del1.txt -o c:\itrans53\bin\del2.txt -t c:\itrans53\bin\itx2iht2.tbl
rem *************** START GUJARATHI FILES ****************
translit -i c:\itrans53\bin\del2.txt -o c:\itrans53\bin\del3.txt -t c:\itrans53\bin\itx2ihtguj3.tbl
copy c:\Itrans53\bin\ihtguj.hdr+c:\itrans53\bin\del3.txt+c:\itrans53\bin\iht.trl c:\itrans53\bin\del.iht
rem *************** END GUJARATHI FILES ******************
itrans -v -i c:\itrans53\bin\del.iht -o C:\ITRANS53\HTML\out.html
goto SHOWHTML
rem ================================================================
rem                         %1 = TXT2ROMAN
rem ================================================================

:TXT2ROMAN
cd\
cd LocalMiKTeX 2.6\doc\txt
copy %2.txt c:\itrans53\bin\out.txt

copy c:\itrans53\bin\header.hdr+c:\itrans53\bin\out.TXT c:\itrans53\bin\temp.txt
echo ----Now deleting any temporary delatable del*.* Files -----
IF EXIST c:\itrans53\bin\del*.* del c:\itrans53\bin\del*.*
echo ------------------------------------------------------------
cd\
cd itrans53\bin
translit -i c:\itrans53\bin\Temp.txt -o c:\itrans53\bin\del1.txt -t c:\itrans53\bin\itx2iht1.tbl
translit -i c:\itrans53\bin\del1.txt -o c:\itrans53\bin\del2.txt -t c:\itrans53\bin\itx2iht2.tbl

rem **************** START ROMAN ******************
translit -i c:\itrans53\bin\del2.txt -o c:\itrans53\bin\del3.txt -t c:\itrans53\bin\itx2ihtroman3.tbl
copy c:\Itrans53\bin\alllangs.hdr+c:\itrans53\bin\del3.txt+c:\itrans53\bin\iht.trl c:\itrans53\bin\del.iht
rem **************** END   ROMAN ******************

itrans -v -i c:\itrans53\bin\del.iht -o C:\ITRANS53\HTML\out.html
goto SHOWHTML
rem ===============================================================
rem                         %1 = TXT2TAMIL
rem ===============================================================

:TXT2TAMIL
cd\
cd LocalMiKTeX 2.6\doc\txt
copy %2.txt c:\itrans53\bin\out.txt

copy c:\itrans53\bin\header.hdr+c:\itrans53\bin\out.TXT c:\itrans53\bin\temp.txt
echo ----Now deleting any temporary delatable del*.* Files -----
IF EXIST c:\itrans53\bin\del*.* del c:\itrans53\bin\del*.*
echo ------------------------------------------------------------
cd\
cd itrans53\bin
rem ============ START TAMIL ==================
translit -i c:\itrans53\bin\Temp.txt -o c:\itrans53\bin\del1.txt -t c:\itrans53\bin\itx2tam1.tbl
translit -i c:\itrans53\bin\del1.txt -o c:\itrans53\bin\del2.txt -t c:\itrans53\bin\itx2tam2.tbl
translit -i c:\itrans53\bin\del2.txt -o c:\itrans53\bin\del3.txt -t c:\itrans53\bin\tam2fix.tbl
copy c:\Itrans53\bin\tml-iht1.hdr+c:\itrans53\bin\del3.txt+c:\itrans53\bin\iht.trl c:\itrans53\bin\del.iht
rem ============ END TAMIL ====================

itrans -v -i c:\itrans53\bin\del.iht -o C:\ITRANS53\HTML\out.html
goto SHOWHTML

rem ==================================================================
rem                   END OF MIKVIEW BATCH FILE
rem ==================================================================

:END

