Echo Off
Cls
Set OldPath=C:\WIN95;C:\WIN95\COMMAND;C:\DOS;C:\UTILS;C:\DEV\SOUND16
Set PATH=C:\ORCADEXE
If not C:\WIN95;C:\WIN95\COMMAND;C:\DOS;C:\UTILS;C:\DEV\SOUND16. == C:\ORCADEXE. Goto ENVERR
Set ORCADEXE=C:\ORCADEXE\
If not . == C:\ORCADEXE\. Goto ENVERR
Set ORCADESP=C:\ORCADESP\
If not . == C:\ORCADESP\. Goto ENVERR
Set ORCADUSER=C:\ORCADESP\
If not . == C:\ORCADESP\. Goto ENVERR
Set ORCADPROJ=C:\ORCAD\
If not . == C:\ORCAD\. Goto ENVERR
Set  NoCfgFile=FALSE
If not . == FALSE. Goto ENVERR
Set  NoDatFile=FALSE
If not . == FALSE. Goto ENVERR
Set  NoMrgExe=FALSE
If not . == FALSE. Goto ENVERR
Set  NoMrgFile=FALSE
If not . == FALSE. Goto ENVERR
Set NoProj=FALSE
If not . == FALSE. Goto ENVERR
Set NoOldTmplt=FALSE
If not . == FALSE. Goto ENVERR
Set NoNewTmplt=FALSE
If not . == FALSE. Goto ENVERR
If not exist C:\ORCAD\TEMPLATE\NUL set NoNewTmplt=TRUE
If not exist C:\ORCAD\TEMPLATE\NUL set NoOldTmplt=TRUE
C:
Cd \ORCAD\TEMPLATE
Cd \ORCAD\TEMPLATE
SDT_C /B
Cd \ORCAD\TUTOR
SDT_C /B
Cd \ORCAD\TEMPLATE

:CHKMRGEXE
Cd C:\ORCADEXE
If not exist C:MERGEDAT.EXE set NoMrgExe=TRUE

:CHKCFG
If . == TRUE. goto CHKDAT
Cd C:\ORCAD\TEMPLATE
If exist ESP.CFG goto CHKDAT
If . == TRUE. set NoCfgFile=TRUE
If . == TRUE. goto CHKDAT
Cd C:\ORCAD\TEMPLATE
If not exist C:ESP.CFG set NoCfgFile=TRUE
Cd C:\ORCAD\TEMPLATE
If . == TRUE. goto CHKDAT
Copy C:\ORCAD\TEMPLATE\ESP.CFG .\*.*

:CHKDAT
If exist ORCADESP.DAT goto CHKMRG
If not exist C:\ORCADESP\NUL goto CHKMRG
Cd C:\ORCADESP
If not exist C:ORCADESP.NEW set NoDatFile=TRUE
If . == TRUE. goto CHKMRG
If . == TRUE. goto CHKMRG
Cd C:\ORCAD\TEMPLATE
Copy C:\ORCADESP\ORCADESP.NEW .\ORCADESP.DAT
Cd C:\ORCAD\TUTOR
Copy C:\ORCADESP\ORCADESP.NEW .\ORCADESP.DAT
Cd C:\ORCAD\TEMPLATE

:CHKMRG
If not exist C:\ORCADESP\SDT386.MRG set NoMrgFile=TRUE

If  . == TRUE. goto CHKPROJ
If   . == TRUE. goto CHKPROJ
If  . == TRUE. goto CHKPROJ
If . == TRUE. goto CHKPROJ
Cls
Echo.
Echo.
Echo     Updating ORCADESP.DAT files in design directories...
Echo.
Set ORCADPROJ=C:\ORCAD\
If not . == C:\ORCAD\. Goto ENVERR
MERGEDAT SDT386.MRG /P
FIXDAT /U /A

:CHKPROJ
If . == FALSE. goto CHKTMPLT
Cls
Echo.
Echo.
Echo.
Echo ERROR:  It appears that the project directory shown below does not exist.
Echo         The conversions of schematics and libraries in design directories
Echo         was therefore aborted.
Echo.
Echo C:\ORCAD
Echo.
Pause
:CHKTMPLT
If . == FALSE. goto CHK4ERR
Cls
Echo.
Echo.
Echo ERROR:  The TEMPLATE directory was not found in
Echo.
Echo           C:\ORCAD
Echo.
Echo This directory is necessary for the ESP Design Environment to
Echo operate.  If you are planning to use ESP, you should consider
Echo reinstalling ESP and specifying the path shown above for the project
Echo directory when prompted for it.
Echo.
Echo.
Pause

:CHK4ERR
If . == TRUE. goto FILEERR
If . == TRUE. goto FILEERR
If  . == TRUE. goto FILEERR
If . == TRUE. goto FILEERR
Goto END
:FILEERR

Echo  ERROR:  Unable to find the following file(s).
Echo.
If  . == TRUE. echo          C:\ORCADESP\MERGEDAT.EXE
If . == TRUE. echo          C:\ORCADESP\SDT386.MRG
If . == TRUE. echo          C:\ORCAD\TEMPLATE\ORCADESP.DAT
If . == TRUE. echo          C:\ORCAD\TEMPLATE\ESP.CFG
Echo.
Echo          The files listed above are critical for this update process to
Echo          complete. 
Echo.
Pause
:MRGEXE
If not . == TRUE. goto MRG
Echo.
Echo          MERGEDAT.EXE is used to update the ORCADESP.DAT file to reflect the
Echo          presence of the SDT 386+ product.  This results in different buttons
Echo          and local configurations on the SDT 386+ screen.
Echo.
Pause
:MRG
If not . == TRUE. goto CFG
Echo.
Echo          The SDT386.MRG file is used to update the screen buttons, SDT 386+
Echo          executable references, and SDT 386+ local configurations for ESP.
Echo.
Pause
:CFG
If not . == TRUE. goto DAT
Echo.
Echo          The ESP.CFG file contains the configuration information for the ESP
Echo          Design Environment and should be present only in the TEMPLATE
Echo          directory.
Echo.
Pause
:DAT
If not . == TRUE. goto END
Echo.
Echo          The ORCADESP.DAT file may have been missed if
Echo.
Echo              C:\ORCAD\TEMPLATE
Echo.
Echo          is not where you normally store your project directories.  You will
Echo          need to manually update the ORCADESP.DAT file in each of your
Echo          design directories.
Echo.
Echo          For instructions on manually updating the ORCADESP.DAT file,
Echo          please see OrCAD Technical Note #45.  If you do not have a
Echo          copy, our Technical Support BBS or our Customer Service
Echo          department can provide you with one.
Echo.
Pause
:CONVERT
Goto END

:ENVERR
Cls
Echo.
Echo.
Echo     ERROR: It appears that there is not enough environment space to
Echo            temporarily set environment variables required to perform
Echo            the automatic conversion of the files you have indicated.
Echo            You may need to increase your environment size by adding
Echo            or modifying the SHELL statement in your CONFIG.SYS file
Echo            as described in your DOS manual.
Echo.
Echo            If you do not wish to modify your CONFIG.SYS file, you may
Echo            also run this batch file from the DOS prompt using the
Echo            following command line:
Echo.
Echo                command /e:4096 /c sdtconv.bat
Echo.
Echo            You will need to be in the directory shown below to run
Echo            the conversion/update batch file:
Echo.
Echo                C:\ORCAD\TEMPLATE
Echo.
Echo            If environment space is still a problem, increase the
Echo            value following /e: on the command shown above and try again.
Echo.
Echo.
Pause
Goto END

:END
Cd C:\ORCAD\TEMPLATE
Set  NoCfgFile=
Set  NoDatFile=
Set   NoMrgExe=
Set  NoMrgFile=
Set     NoProj=
Set NoNewTmplt=
Set NoOldTmplt=
Set      PATH=
Set   OldPath=
Set  ORCADEXE=
Set  ORCADESP=
Set ORCADUSER=
Set ORCADPROJ=
