;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Purpose
;;   Installation script for MicroSim Design Center
;;   Evaluation Version under Windows 3.0
;;
;; Returned value
;;
;; Discussion
;;   Uses Instalit for Windows, by HPI
;;
;; Author
;;   kws - 07 Feb 92 - created
;;   kws - 15 Jul 92 - version numbers (52 and 5.2) in directory 
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
do initializeInstall

[pointSTART]
getMenuChoice
  Install Design Center Evaluation Version.
  Copy one file from the installation disks.
  Exit Installation program.
endGetMenuChoice

inCase choice is
  =1: queAllFiles
      [number1] := 1
  =2: [number1] := 2
      do copyOneFile
  =3: do exitInstall 
endInCase

[pointGETDIRECTORY]

;; Check for hard disk A: (NEC) or C:
if driveIsPresent A
  if driveIsRemoveable A
    determineInstallationDirectory C:\MSIMEV53 requireFixed noCreate
  else
    determineInstallationDirectory A:\MSIMEV53 requireFixed noCreate
  endif
else
  determineInstallationDirectory requireFixed noCreate
endif

if directoryExists [installationDirectory]
  dialog [yesOrNo1] useHeader "Delete Existing Files"
    The directory [installationDirectory] already exists.

    Select 'Yes' to copy new files to this directory,
    overwriting files of the same name, like PSCHED.EXE, etc.
    Select 'No' to specify a different installation directory.

  endDialog

  if [yesOrNo1] = n 
    goto [pointGETDIRECTORY]
  endif
endIf

if [number1] = 1                       
  ;; [number1] always set to installation menu choice (1 == full install)
  if freeSpaceOnDrive installationDrive < queSize 
    dialog [yesOrNo1] useHeader "Installation Error"
      Insufficient space on this disk drive, need at least
      queSize bytes.  Do you wish to select another drive?
    endDialog
    if [yesOrNo1] = y 
      goto [pointGETDIRECTORY]
    else 
      do abortInstall
    endif
  endif
endif  

if [number1] = 1
  ;; get readme.* and *.by uncompressed files
  copyFiles
    readme.*
    *.by
    msim.ini
  endCopyFiles

  createDirectoryIfNecessary [installationDirectory]\BACKUP

endif

;; copy all user selected files now
getQuedFiles onePerLine noInsertionPrompt

setCompletionStatusTo finished

;; install program groups if in Windows and doing a full install
if Windows
  if [number1] = 1
    dialog [yesOrNo1] useHeader "Design Center 5.3 Group"
      Do you want to create a Design Center group with
      icons for the programs (PSpice, Probe, etc.)?
    endDialog

    if [yesOrNo1] = y
      buildProgramGroup "Design Center Eval" MSIMEV53.GRP replace
        [installationDirectory]\psched.exe  "Schematics"      [installationDirectory]\psched.exe
        [installationDirectory]\wpspice.exe "PSpice"          [installationDirectory]\wpspice.exe
        [installationDirectory]\probe.exe   "Probe"           [installationDirectory]\probe.exe
        [installationDirectory]\stmed.exe   "Stimulus Editor" [windowsDirectory]\progman.exe
        [installationDirectory]\parts.exe   "Parts"           [windowsDirectory]\progman.exe
      endBuildProgramGroup
    endif
  endif

  if protectedMode
  else
    dialog useHeader "Installation Warning"
      You are currently running in real mode.
      The MicroSim Design Center requires
      Windows to be run in protected mode.
    endDialog
  endif
endif

;; noSysFileConfirmation

if [number1] = 1
  dialog [yesOrNo1] useHeader "Modify AUTOEXEC.BAT?"
    Do you want the Design Center directory added to your
    path in the AUTOEXEC.BAT file?  (This must be done for 
    the Design Center to execute properly)
  endDialog
  if [yesOrNo1] = y
    modifyAutoexecBat
      addPathComponent [installationDirectory] at beginning
    endModifyAutoexecBat
  endif

  ;; install msim.ini in Windows directory, modify LIBPATH and BACKUP
  if Windows
[pointMSIMINI]
    if fileExists [windowsDirectory]\msim.ini
      [string3] := MSIM.BAK
      dialog [string3] useHeader "Modifying MSIM.INI"
        The MSIM.INI file is about to be installed in the
        Windows directory, however a previous version of MSIM.INI 
        has been detected. Please enter a backup file name for
        the previous version of MSIM.INI to be saved as: 
      endDialog  
    endif
  
    if [string3] = blankString
    else
      if fileExists [windowsDirectory]\[string3]
        dialog [yesOrNo1] useHeader "Modifying MSIM.INI"
          The file [windowsDirectory]\[string3] already exists.
          Do you want to write over it?
        endDialog
        if [yesOrNo1] = n
          goto [pointMSIMINI]
        else
          deleteFiles from [windowsDirectory]
            [string3]
          endDeleteFiles
        endif
      endif
      renameFile [windowsDirectory]\msim.ini to [string3]
    endif
  
    copyFiles from [installationDirectory] to [windowsDirectory]
      msim.ini
    endCopyFiles
  
    deleteFiles from [installationDirectory]
      msim.ini
    endDeleteFiles
  
    [array1][1] := MICROSIM
    [array1][2] := LIBPATH
    [array1][3] := [installationDirectory]\LIB
    [array1][4] := [windowsDirectory]\MSIM.INI
    writePrivateProfileString using [array1]
  
    [array1][1] := SCHEMATICS
    [array1][2] := BACKUP
    [array1][3] := [installationDirectory]\BACKUP
    [array1][4] := [windowsDirectory]\MSIM.INI
    writePrivateProfileString using [array1]

  endif  ;; if windows
endif  ;; if [number1] = 1

if [number1] = 1
  dialog [yesOrNo1] useHeader "Run SETUPDEV.EXE"
    Do you want to run the DOS SETUPDEV.EXE program to 
    create a PSPICE.DEV file that sets up the monitor and 
    printer for the DOS programs PARTS.EXE and STMED.EXE?
  endDialog
  if [yesOrNo1] = y
    run  [installationDirectory]\setupdev.exe -d [installationDirectory]\pspice.dev
  endif  

  ;; [number1] always set to installation menu choice (1 == full install)
  dialog useHeader "Design Center Installation"
    Your Evaluation Design Center installation is now complete.
    You must reboot the computer for changes to your AUTOEXEC.BAT,
    CONFIG.SYS, and/or Windows *.INI files to take effect.  

    Please use Notepad to view the README.DOC
    and README.SCM files.

  endDialog
else
  dialog useHeader "Partial Installation"
    Your partial installation is now complete.
  endDialog
  goto [pointSTART]
endif

soLong                                 ;; exit installation pgm



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Purpose
;;   Allow user to copy one file from compressed disks.
;;
;; Returned value
;;
;; Discussion
;;   File is only put in queue, must still be a 'getQuedFiles' call
;;
;; Author
;;   kws - 03 Dec 90 - created
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure copyOneFile
[pointCOPYFILE]
  dialog [string1] useHeader "Extracting a file from installation Disks"
    Please enter the name of the file you wish to copy
    from the installation disks (press ENTER to exit):
  endDialog

  if [string1] = blankString
    exit
  endif

  if [string1] contains \
    popup Please enter just the file name with no path.
    goto [pointCOPYFILE]
  endif

  if lengthOf [string1] > 12
    popup The file name is too long.
    goto [pointCOPYFILE]
  endif

  if fileIsInLibrary [string1]
  else
    popup Can't find that file name on the installation disks.
    goto [pointCOPYFILE]
  endif

  queFiles
    [string1]
  endQueFiles

endProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Purpose
;;   Initialize windows at start of install
;;
;; Returned value
;;
;; Discussion
;;
;; Author
;;   kws - 03 Dec 90 - created
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure initializeInstall
  setTopLineTo MicroSim Design Center Installation (ESC to quit)

  setBackdrop off
  setDefaultBitmap off

  if windows
    setAttentionAttrTo blackOnWhite
    setScreenAttrTo blackOnWhite
    setBackgroundColor 192 192 192 192 192 192
    setDithering off
  endif

  showWindow maximize
  clearScreen

  setSupportInformation
    For assistance please call the MicroSim Product
    Support Group or the MicroSim Technical Support
    group at (714) 837-0790

    MicroSim Corporation
    20 Fairbanks
    Irvine, CA   92718

    Fax: (714) 455-0554
  endSetSupportInformation

endProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Purpose
;;   Abort installation
;;
;; Returned value
;;
;; Discussion
;;   Put any cleanup funcs here.
;;
;; Author
;;   kws - 03 Dec 90 - created
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure abortInstall
  popup Evaluation Design Center installation aborted.
  soLong
endProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Purpose
;;   Exit installation
;;
;; Returned value
;;
;; Discussion
;;   Put any cleanup funcs here.
;;
;; Author
;;   kws - 03 Dec 90 - created
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure exitInstall
  soLong
endProcedure



endScript





