@echo off
if not "%WINDIR%"=="" goto UNDERWIN
if "%1"=="" goto NOINPUT
if "%2"=="" goto NOINPUT
if "%3"=="" goto NOINPUT
if "%4"=="" goto NOINPUT
rem if not exist %4\*.* goto NOWINDIR

set sourceDrv=%1
set AppFiles=%2%3
set HSIDrvr=%2%3
set System=%4\SYSTEM
set Setup=%2%3\SETUP
set OptFiles1=%2%3\TUTOR
set OptFiles2=%2%3\EXAMPLES
set INPUTDLG=%2%3\EXAMPLES\INPUTDLG
set DATA2DLL=%2%3\EXAMPLES\DATA2DLL
set DLLSHELL=%2%3\EXAMPLES\DLLSHELL
rem set TEMPLATE=%2%3\EXAMPLES\TEMPLATE

echo Installing Axum from drive %sourceDrv%
echo:
echo Installing Axum Program files to: %AppFiles%
echo Installing Axum Un-installer to: %Setup%
echo Installing Axum Tutorial to: %OptFiles1%
echo Installing Axum Example files to: %OptFiles2%
echo Installing Windows shared files to: %System%
pause

if not exist %AppFiles%\*.* md %AppFiles% > nul
if not exist %Setup%\*.* md %Setup% > nul
if not exist %OptFiles1%\*.* md %OptFiles1% > nul
if not exist %OptFiles2%\*.* md %OptFiles2% > nul
if not exist %INPUTDLG%\*.* md %INPUTDLG% > nul
if not exist %DATA2DLL%\*.* md %DATA2DLL% > nul
if not exist %DLLSHELL%\*.* md %DLLSHELL% > nul
rem if not exist %TEMPLATE%\*.* md %TEMPLATE% > nul

REM Write TRIMETRX.INI file
echo Writing TRIMETRX.INI file into %4\TRIMETRX.INI...

echo [Extensions] > %4\TRIMETRX.INI
echo Extension1=TXGED.DLL >> %4\TRIMETRX.INI
echo Extension2=TXDED.DLL >> %4\TRIMETRX.INI
echo Extension3=TXSCRIPT.DLL >> %4\TRIMETRX.INI
echo Extension4=TXGR.DLL >> %4\TRIMETRX.INI
echo Extension5=TXGRA.DLL >> %4\TRIMETRX.INI
echo Extension6=TXGR2.DLL >> %4\TRIMETRX.INI
echo Extension7=TXGR3.DLL >> %4\TRIMETRX.INI
echo Extension8=TXTED.DLL >> %4\TRIMETRX.INI
echo Extension9=TXGRP.DLL >> %4\TRIMETRX.INI
echo: >> %4\TRIMETRX.INI
echo [Recent File List] >> %4\TRIMETRX.INI
echo: >> %4\TRIMETRX.INI
echo [Paths] >> %4\TRIMETRX.INI
echo Application=%AppFiles%\ >> %4\TRIMETRX.INI
echo Tutorial=%OptFiles1%\ >> %4\TRIMETRX.INI
echo Utility=%AppFiles%\ >> %4\TRIMETRX.INI
echo Setup=%Setup%\ >> %4\TRIMETRX.INI
echo DataSheets=%OptFiles2%\ >> %4\TRIMETRX.INI
echo GraphSheets=%OptFiles2%\ >> %4\TRIMETRX.INI
echo Scripts=%OptFiles2%\ >> %4\TRIMETRX.INI
echo Projects=%OptFiles2%\ >> %4\TRIMETRX.INI
REM -------------------------------------------------------------------

copy %1\instutil.bat %AppFiles%
copy %1\expand.exe %AppFiles%
%2
cd %AppFiles%
INSTUTIL.BAT

:NOINPUT
echo You need to specify what drive and directory
echo to install Axum files into. Also, you need to
echo specify what drive and directory contains
echo Windows 3.1 or higher, and the drive to install
echo from (i.e. A:)
echo:
echo For example, type the following to install
echo Axum files into C:\AXUMW and update system
echo files in your Windows directory C:\WINDOWS...
echo:
echo INSTALL A: C: \AXUMW C:\WINDOWS
goto END

:NOWINDIR
echo THE WINDOWS DIRECTORY YOU SPECIFIED DOES NOT EXIST!
echo You need to specify what drive and directory
echo contains Windows 3.1 or higher.
echo:
echo For example, type the following to install
echo Axum files into C:\AXUMW and update system
echo files in your Windows directory C:\WINDOWS...
echo:
echo INSTALL A: C: \AXUMW C:\WINDOWS
goto END

:UNDERWIN
echo This install program must be run at the DOS
echo prompt while NOT running under Windows.
echo:
echo PLEASE EXIT WINDOWS AND RE-RUN THIS INSTALL PROGRAM
pause
goto END

:END
set AppFiles=
set System=
set Setup=
set OptFiles1=
set OptFiles2=
set HSIDrvr=
set INPUTDLG=
set DATA2DLL=
set DLLSHELL=
set TEMPLATE=
set sourceDrv=
