/* __________ DEFINE PROJECT __________ */

@DefineProject                      
    @Name       = "MASTERCAM"
    @Version    = "5.5"
    @Subdir     = "\\MILL55"
    @OutDrive   = C          
    @Immediate  = @TRUE      
    @InDiskBell = @TRUE      
    @Requires @HardDisk
@EndProject                         

/* __________ INITIALIZE VARIABLES __________ */

@DefineVars
    @Qstring @Product = "MASTERCAM MCTV"
    @Qstring @HlpDOC  = "MCTV.HLP"
    @Qstring @HlpEXE  = "WINHELP"
    @Qstring @HlpTXT  = "MCTV User Guide"
    @Qstring @CGroup  = ""
    @Qstring @AItemH  = ""
    @Integer @Red     = @RGB(255,0,0) //DEFINE COLOR RED
    @Integer @Black   = @RGB(0,0,0)   //DEFINE COLOR BLACK
    @Integer @TempInt = -1
@EndVars

/* __________ SAY HELLO __________ */

@BackgroundMode(3,@Red,@Black)
@Display
    @Cls
    This program will install @Product version @Version on your computer.
    You may press the [Esc] key at any time to abort the installation.

    Each question has a default answer.  If the default answer is
    correct, press the [ENTER] key in response to the question.
    Otherwise, type the answer and then press the [ENTER] key.

    If you make a mistake while typing, press the [BACKSPACE] key
    and then retype the answer.
    @Pause
@EndDisplay

/* __________ GET DRIVE __________ */

NEWDRIVE:                                   // re-select drive if needed
@GetOutDrive
    @Cls
    Select drive on which MASTERCAM was installed ...
    @DlgCtrlSize(0,3,2,8,30)
    @Suppress(0,17)
@EndOutDrive

/* __________ GET DIRECTORY __________ */

NEWDIR:
@GetSubdir
    @Cls
    Specify MASTERCAM main directory ...
    @DlgCtrlSize(0,3,2,4,30)
@EndSubdir

/* __________ REMOVE DRIVE - IF ENTERED __________ */

@TempInt = @StrFind ("@SubDir", ":")
@If (@TempInt >= 0)
    @SubDir = "@StrDel ("@SubDir", 0, (@TempInt+1))"
@EndIf

/* __________ REMOVE PERIOD - IF ENTERED __________ */

@TempInt = @StrFind ("@SubDir", ".")
@If (@TempInt >= 0)
    @Display
        MASTERCAM products do not support
        directories which contain periods.

        Please select another directory.
        @Pause
    @EndDisplay
    @GOTO NEWDIR
@EndIf

/* __________ CHECK MILL55 INSTALLED __________ */

@If (!@Exists "@Outdrive:\\@Subdir\\MILL55.EXE")
    @Display
        MASTERCAM MILL version 5.5 not found!

        Please select another drive.
        @Pause
    @EndDisplay
    @GOTO NEWDRIVE
@EndIf

/* __________ CREATE ALL SUBDIRECTORIES __________ */

@MkDir ("@OutDrive:\\@Subdir\\WNSEE")
@MkDir ("@OutDrive:\\@Subdir\\WNSEE\\CONTROLS")
@MkDir ("@OutDrive:\\@Subdir\\WNSEE\\HELP")
@MkDir ("@OutDrive:\\@Subdir\\WNSEE\\SYSTEM")
@MkDir ("@OutDrive:\\@Subdir\\WNSEE\\TEMP")

/* __________ INSTALL FILES __________ */

@DefineDisk
    @Label = "Disk #1"
    @BeginLib CONTROLS.RED
        @File *.* @Out @Outdrive:\\@Subdir\\WNSEE\\CONTROLS\\*.*
    @EndLib
    @BeginLib SYSTEM.RED
        @File *.* @Out @Outdrive:\\@Subdir\\WNSEE\\SYSTEM\\*.*
    @EndLib
    @BeginLib WNSEE.RED
        @File MC.DLL @Out @WindowsDrive:\\@WindowsDir\\MC.DLL
        @File *.* @Out @Outdrive:\\@Subdir\\WNSEE\\*.*
    @EndLib
    @BeginLib MCTVHLP.RED
        @File *.*
    @EndLib
    @BeginLib MCTV.RED
        @File *.*
    @EndLib
@EndDisk

/* __________ CREATE MASTERCAM GROUP __________ */

@CGroup = "[CreateGroup(Mastercam)]"
@AItemH = "[AddItem(@HlpEXE @HlpDOC, @HlpTXT,,,,,@Outdrive:\\@Subdir)]"
@ProgramManager("@CGroup@AItemH")

/* __________ WRITE INSTALLATION DIRECTORY TO FILE (DIR.DOC) __________ */

@Write ("@OutDrive:@Subdir\\WNSEE\\DIR.DOC","wt","@OutDrive:@Subdir\\WNSEE\n")

/* __________ RETURN TO STARTUP DIRECTORY __________ */

@If (5000 [= @OPTION)
    @ChDrive (@StartupDrive)
    @ChDir ("@StartupDir")
@Endif

/* __________ INSTALLATION COMPLETE __________ */

@Finish
    @Cls
    @Product installation complete ...
    @Pause
@EndFinish
