@DefineProject
    @Name       = "OrCAD/ESP"
    @Version    = "V4.20"
    @OutDrive   = C
    @SubDir     = "\\ORCADESP\\"
@EndProject

@DefineVars
    @Dir @ORCADPROJ = "\\ORCAD"
    @Dir @ORCADEXE = "\\ORCADEXE"
    @Dir @ORCADESP = "\\ORCADESP"
    @QString @DefaultVideo = "EGA16E.DRV"
    @QString @DefaultEditorPath = "@OutDrive:@ORCADEXE"
    @QString @DefaultEditor = "M2EDIT.EXE"
@EndVars

@If (@Exists "@OutDrive:@ORCADEXE\\ESPMAIN.EXE"
&&   @Exists "@OutDrive:@ORCADPROJ\\TEMPLATE\\ESP.CFG")
    @DefineVars
        @Integer @ESPFlag = 1
    @EndVars
@Else
    @DefineVars
        @Integer @ESPFlag = 0
    @EndVars
@EndIf

@If (@ESPFlag == 0)
    @GetOption
        @CheckBox
        @Cls
      It appears that the ESP design environment isn't installed or wasn't 
               installed using OrCAD's default directory structure.







        Note: Selecting YES assumes you are installing the ESP design
              environment for the first time. Selecting NO assumes that
              you already have ESP installed but not in the following
              directories: @OutDrive:@ORCADEXE or at @OutDrive:@ORCADPROJ\TEMPLATE.



        The SPACE BAR toggles the selection between yes and no. 
        'Y' sets entry to YES, 'N' sets entry to NO.
        Press <ENTER> when you have finished selecting.
        @Option 4 = "Is this a new installation of the ESP design environment?"
    @EndOption

    @GetOption
        @CheckBox
        @Cls
        Do you want to modify ONE or MORE of the following items?
                      CURRENT INSTALLATION PARAMETERS













        The SPACE BAR toggles the selection between yes and no. 
        The arrow keys and PGUP/PGDN keys move the selection up and down.
        'Y' sets all entries to YES, 'N' sets all to NO.
        Press <ENTER> when you have finished selecting.
        @Option 10 = "Change Target Harddrive from:              @OutDrive:"
        @Option 15 = "Change Main Driver/Library directory from: @ORCADESP "
        @Option 11 = "Change Executable program directory from:  @ORCADEXE "
        @Option 12 = "Change Project directory from:             @ORCADPROJ"
        @If ( 4 [= @Option )     /*Changes not allowed in custom installation*/
            @Option 13 = "Change default video driver from:          @DefaultVideo"
            @Option 14 = "Change default editor from: @DefaultEditorPath\\@DefaultEditor"
        @EndIf
    @EndOption
@Else   /* ESP was found on default drive and directories */
    @GetOption
    @Cls
   Do you want ALL of the ORCADESP.DAT files in your project sub-directories
   updated to @Version?
 
 
 
 
 
 
 
 
      NOTE: This installation procedure assumes that your program directory
            at @ORCADEXE and TEMPLATE project directory at @ORCADPROJ are
            on the same drive (@OutDrive:). If your projects are on a separate 
            drive select NO and manually update your ORCADESP.DAT files by
            following the directions in the READ.ME file on the diskette.
 
 
          The arrow keys and PGUP/PGDN keys move the selection up and down.

          Press <ENTER> when you have finished selecting.
          @Option 5 = "YES"
          @Option 6 = " NO"
    @EndOption
@EndIf

@If ( 10 [= @Option )
    @GetOutDrive
        @CLS
    On which disk drive will be the destination of this install?
    @EndOutDrive
@EndIf

@If ( 11 [= @Option )
    @GetSubdir @ORCADEXE
    The @ORCADEXE directory will contain the installation program as well
    as the executables of any of the OrCAD EDA Tool sets.  The default name 
    for this directory is @ORCADEXE
        @Prompt = "What subdirectory for the executables ([Enter] = @ORCADEXE) ?"
    @EndSubDir
@EndIf

@If ( 12 [= @Option )
    @GetSubdir @ORCADPROJ
    The @ORCADPROJ directory contains a subdirectory for each design
    that you will be working with. The default name for this directory
    is @ORCADPROJ 
        @Prompt = "ROOT directory for OrCAD designs ([Enter] = @ORCADPROJ) ?"
    @EndSubDir
@EndIf

@If ( 15 [= @Option )
    @GetSubdir @ORCADESP  
    The @ORCADESP directory contains a subdirectory for the display,
    printer, and plotter drivers.  This directory also will contain
    a subdirectory for each OrCAD Tool Set you install.
        @Prompt = "What directory for ORCADESP ([Enter] = @ORCADESP) ?"
    @EndSubDir
@EndIf

@If ( 13 [= @Option )
     @GetOption
         @Cls
     Please select your generic display adapter type for the ESP Design
     Environment.
    











          The arrow keys and PGUP/PGDN keys move the selection up and down.

          Press <ENTER> when you have finished selecting.
          @Option 50 = "EGA  display adapter"
          @Option 51 = "VGA  display adapter"
          @Option 52 = "VESA display adapter"
          @Option 53 = "Hercules  Monochrome"
     @EndOption
@EndIf

@If ( 14 [= @Option )
    @GetString @DefaultEditorPath
        @Default = "@OutDrive:@ORCADEXE"

        @Prompt = " Please enter the new editor path (ENTER = @DefaultEditorPath)"
    @EndString

    @GetString @DefaultEditor
        @Default = "M2EDIT.EXE"

        @Prompt = " Please enter the new editor  (ENTER = @DefaultEditor)"
    @EndString
@EndIf

@If ( (@ESPFlag == 0) && (4 [! @Option) )

    /*  This section of script checks for the presence of the ESP design 
        environment after the user has modified items from the installation
        menu. This section will only be executed if ESP wasn't found in the
        default areas and the user indicated this wasn't a new installation.

        If the design environment still can't be found a message will be
        displayed for the user informing him/her where the updated DAT file
        will be located and to read the READ.ME on the diskkette for how to
        update their designs.
    */

    @If (@Exists "@OutDrive:@ORCADEXE\\ESPMAIN.EXE"
    &&   @Exists "@OutDrive:@ORCADPROJ\\TEMPLATE\\ESP.CFG")
        @DefineVars
            @Integer @CustomESPFlag = 1
        @EndVars
    @Else
        @DefineVars
            @Integer @CustomESPFlag = 0
        @EndVars
    @EndIf

    @If ( @CustomESPFlag == 1 )
        @GetOption
            @Cls
   Do you want ALL of the ORCADESP.DAT files in your project sub-directories
   updated to the version on this diskette?
 
 
 
 
 
 
 
 
      NOTE: This installation procedure assumes that your program directory
            at @ORCADEXE and TEMPLATE project directory at @ORCADPROJ are
            on the same drive (@OutDrive:). If your projects are on a separate 
            drive select NO and manually update your ORCADESP.DAT files by
            following the directions in the READ.ME file on the diskette.
 
 
          The arrow keys and PGUP/PGDN keys move the selection up and down.

          Press <ENTER> when you have finished selecting.
            @Option 7 = "YES"
            @Option 8 = " NO"
        @EndOption
    @Else
        @Display
            @Cls


        OrCAD ESP design environment files were not found! This procedure
        scanned @ORCADEXE for ESPMAIN.EXE and @ORCADPROJ\TEMPLATE for
        ESP.CFG.

        Since the design environment wasn't found this installation
        procedure will put the updated DAT file (ORCADESP.NEW) in
        @ORCADPROJ\TEMPLATE and the design environment program files
        will be put into @ORCADEXE.

        Please read the READ.ME file on the diskette for how to use 
        FIXDAT.EXE to update the ORCADESP.DAT files in your project
        subdirectories or press the ESCAPE key to abort the installation.


            @pause

        @EndDisplay

    @EndIf
@Else
    @DefineVars
        @Integer @CustomESPFlag = 0
    @EndVars
@EndIF

@DefineDisk
    @Label = "IBM ESP Framework Diskette"
    @BeginLib ESP.PLB
        @File        *.EXE
            @Out0k \\@ORCADEXE\\*.EXE
        @File      M2E.HLP
            @Out0k  \\@ORCADEXE\\M2E.HLP
        @File ORCADESP.HLP
            @Out0k \\@ORCADESP\\ORCADESP.HLP    
        @File  SUSPEND.BAT
            @Out0k \\@ORCADEXE\\SUSPEND.BAT

        @If ( (@ESPFlag == 0) && (4 [= @Option) )
            /*  This section of the script is only done if ESP wasn't
                found and the user indicates that this is a new installation.
            */
            @File ORCADESP.DAT
                @Out0k \\@ORCADPROJ\\TEMPLATE\\ORCADESP.DAT
            @File  ESPCFG.DEF
                @Out0k \\@ORCADPROJ\\TEMPLATE\\ESPCFG.DEF
            @File DESIGNS.LST
                @Out0k \\@ORCADPROJ\\DESIGNS.LST
        @Else 
            @File ORCADESP.DAT
                @Out0k \\@ORCADPROJ\\TEMPLATE\\ORCADESP.NEW
        @EndIf
    @EndLib
    @File INSTALL2.DAT @Out0k  \\@ORCADEXE\\INSTALL.DAT
@EndDisk

@Finish
    
    @ChDrive @OutDrive
    @ChDir   "@ORCADPROJ\\TEMPLATE"
    
    @If ( @ESPFlag == 0 && (4 [= @Option) )

        /*
		    This section of Script is executed only if ESP wasn't found and
            the user indicated that this was a new installation.
        */

        @System "echo PDRV='@OutDrive:@ORCADESP\\DRV\\' > ESP.cfg"

        @If     ( 50 [= @Option )
             @System "echo DD='EGA16E.DRV' >> ESP.cfg"
        @ElseIf ( 51 [= @Option )
             @System "echo DD='VGA640.DRV' >> ESP.cfg"
        @ElseIf ( 52 [= @Option )
             @System "echo DD='VESA800.DRV' >> ESP.cfg"
        @ElseIf ( 53 [= @Option )
             @System "echo DD='HGC2.DRV' >> ESP.cfg"
        @Else
             @System "echo DD='EGA16E.DRV' >> ESP.cfg"
        @EndIf

        @If ( 14 [= @Option )
            @If ( @Exists "@DefaultEditorPath\\@DefaultEditor" )
                @System "echo EDITOR='@DefaultEditorPath\\@DefaultEditor' >> ESP.cfg"
            @Else
                @Cls
  
 

   *** ERROR: New PATH/EDITOR ( @DefaultEditorPath\@DefaultEditor )
              Not Found!
 
              @OutDrive:@ORCADEXE\M2EDIT.EXE will be used instead.
                @System "echo EDITOR='@OutDrive:@ORCADEXE\\M2EDIT.EXE' >> ESP.cfg"
                @Pause
            @EndIf
        @Else
            @System "echo EDITOR='@OutDrive:@ORCADEXE\\M2EDIT.EXE' >> ESP.cfg"
        @EndIf

        @System "type ESPcfg.def >> ESP.cfg"
        @System "If EXIST ESPcfg.def DEL ESPcfg.def"

        @Cls





                        OrCAD Design Environment



                         Installation Complete



           Remember to send in the registration card to receive the
               OrCAD Pointer newsletter and product updates.



        @Pause
    @EndIf
    
    @If ( (5 [= @Option) || (7 [= @Option) )

        /*  This section of script only gets executed if the user indicates
            they wanted the update to be automatically. In turn the user can
            only choose this if ESP was found in the default areas or was
            found after the user modified the appropriate installation
            choices from the installation menu.
        */

        @Cls
             
             
    You've opted to have the ORCADESP.DAT files in all of your project
    subdirectories automatically updated. This process will update your
    ORCADESP.DAT files to @Version. 
             
    If you choose to abort now by pressing the ESCAPE key please read
    the READ.ME file on the diskette for instructions on how to use
    FIXDAT.EXE to manually update the ORCADESP.DAT files in your project
    sub-directories.
             
    The following procedure will first update the ORCADESP.DAT file in the
    @OutDrive:@ORCADPROJ\TEMPLATE subdirectory and then use it to update
    the remaining ORCADESP.DAT files found by using the ORCADPROJ
    environment variable.
             
    Please note that you must manually update any ORCADESP.DAT files in
    additional project sub-directories that you can define by changing the
    ORCADPROJ environmental variable.
 
        @Pause
        @If (@Exists "ORCADESP.DAT"
          && @Exists "@OutDrive:@ORCADEXE\\FIXDAT.EXE"
          && @Exists "ORCADESP.NEW")
            @Cls










            Updating ORCADESP.DAT files in project directories...

            @System "@OutDrive:@ORCADEXE\\FIXDAT ORCADESP.DAT ORCADESP.NEW /U > NUL"
            @System "@OutDrive:@ORCADEXE\\FIXDAT /A/U > NUL"
            @System "If EXIST ORCADESP.NEW Del ORCADESP.NEW"
            @System "Cls"
        @Else
            @Cls
 
 
 
   *** ERROR: ORCADESP.DAT, ORCADESP.NEW or @OutDrive:@ORCADEXE\FIXDAT.EXE
              Not Found!
 
 
              @OutDrive:@ORCADPROJ\TEMPLATE may not be where you normally store
              your project directories (they may be on another drive).
              If this is true then this installation made a TEMPLATE
              subdirectory on @OutDrive: where your executable files
              are stored and you should have chosen to manually update
              your ORCADESP.DAT files. Please use the ORCADESP.NEW
              file located in the @OutDrive:@ORCADPROJ\TEMPLATE subdirectory
              to update the files in your project subdirectories. The
              READ.ME file on the diskette will tell you how to use 
              FIXDAT.EXE to do update the ORCADESP.DAT files in your
              project subdirectories.
 
            @Pause
            @Abort
        @EndIf
    @EndIf

    @If ( ((@ESPFlag == 1) || (@CustomESPFlag == 1)) && (4 [! @Option) )

        @Cls





                        OrCAD Design Environment



                            Update Complete


      Please read the READ.ME file for the latest information that didn't
      make it into other documentation that you may have received.



      @Pause
    @EndIf

	@If (@Exists "@OutDrive:@ORCADEXE\\VERSION.TXT")
      @System "del @OutDrive:@ORCADEXE\\VERSION.TXT"
    @EndIf

	@System "@OutDrive:@ORCADEXE\\ESPMAIN.EXE /V >NUL"
    @System "Cls"
	@If (@Exists "@OutDrive:@ORCADEXE\\VERSION.TXT")
      @System "del @OutDrive:@ORCADEXE\\VERSION.TXT"
      @Cls

      If you have third party software that integrates directly with
      the ESP design environment, you need to perform these two steps
      to provide a seemless interface:

      1.  Place the .VDT files provided by each third party
          installation process in the @OutDrive:@ORCADESP
          directory.

      2.  Enter @OutDrive:@ORCADEXE\ESPMAIN.EXE /A from
          the command prompt.

      The VDT files contain button specific and logo information for
      the third party software that must be merged with your existing 
      ORCADESP.DAT files.  This is necessary for the successful operation
      of both ESP and the third party software when both are integrated.



	  @Pause
	@Else
      @Cls






   *** WARNING: The version of @OutDrive:@ORCADEXE\ESPMAIN.EXE is older
                than V4.20.  This will prevent you from running
                third party applications seemlessly within the
                ESP framework.






	  @Pause
	@EndIf

@EndFinish
