home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer 14 / 1996-01_Disc_14.iso / cyberspd / cyber.ins < prev    next >
Text File  |  1995-10-20  |  10KB  |  312 lines

  1. DefineVariables
  2.   Text          [ProductName]           := Cyberspeed
  3.   Text          [CompanyName]           := Mindscape
  4.   Text          [MainExeName]           := CYBER.EXE
  5.   Text          [CommandLineArgs1]      := 
  6.   Text          [CommandLineArgs2]      :=
  7.   Text          [ProgGrpName]           := CYBERSPEED
  8.   Text          [ProgGrpFileName]       := CYBER.GRP
  9.   Text          [RegEntryRoot]          := Software
  10.   Text          [RegEntry]              := CybDemo
  11.   Text          [RegAppID]              := Cyberspeed
  12.   Text          [IconName1]             := BIG.ICO
  13.   Text          [UninstallName]         := UNSETUP.EXE
  14.   Text          [UninstallScript]       := UNSETUP.INS
  15.   Text          [ThisWin32sVersion]     := 1.25.142.0
  16.   Text          [LogFile]               := CYBER.LOG
  17.   Text          [TempFile]              :=
  18.   Text          [TempStr]               := 
  19.   Text          [WinVer]                :=
  20.   Text          [WinPlatform]           :=
  21.   Text          [CurrentInstallOpt]     := BlankString
  22.   Text          [Win95DefProgFiles]     := Program Files
  23.   Directory     [PrevInstDir]           := BlankString
  24.   Directory     [SavedGameDir]          := SAVED
  25.   Text          [DefaultDestDir]        := 
  26. ;;  Directory     [ExecDir]               := EXECDIR
  27.   Directory     [DefDest]               := CYBER
  28.   Directory     [LogoDir]               := LOGO
  29.   Logical       [Win95Only]             := NoCharacter
  30.   Logical       [TempYes]               := NoCharacter
  31.   Logical       [BailOut]               := NoCharacter
  32.   Logical       [PreviousInstall]       := NoCharacter
  33.   Logical       [DoWin32sSetup]         := NoCharacter
  34.   Logical       [DoReinstall]           := NoCharacter
  35.   Logical       [Multilingual]          := NoCharacter
  36.   Number        [MaxInstallDirLen]      := 60
  37.   Number        [Continue]              := 1012
  38.   Logical       [Root]                  := NoCharacter
  39.   Logical       [CopyAborted]           := NoCharacter
  40.   Directory     [SourceDir]             :=
  41.   Directory     [TempDir]               := BlankString
  42. EndDefineVariables
  43.  
  44. SetDefaultBitmap Off
  45.  
  46. ;;SetInstallModeTo Install
  47.  
  48. SetTraceMode Off
  49.  
  50. SetExitConfirmationPrompt off
  51.  
  52. SetPopupBorderTo double
  53.  
  54. ;; SetBackgroundColor 0 0 0 0 0 0
  55.  
  56. SetReplacementInquiry Off
  57.  
  58. Logging On
  59.  
  60. Do CheckPreviousInstall
  61.  
  62. :DoneLanguage
  63.  
  64. [WinVer] := WindowsVersion
  65. [WinPlatform] := WindowsPlatform
  66.  
  67. If [PreviousInstall]
  68.     [Number1] := PositionOf [UninstallName] in [CommandLine0]
  69.     If [Number1] > 0
  70.         Do Uninstall
  71.         GoTo Bail
  72.     EndIf
  73. EndIf
  74.  
  75.  
  76. ;; check for uninstall or  reinstall
  77. ;; on the command line. This may be passed by the Win95 autorun
  78. ;; program
  79. If [CommandLine2] = Uninstall
  80.     Do Uninstall
  81.     GoTo Bail
  82. Else
  83.     If [CommandLine2] = Reinstall
  84.     [DoReinstall] := YesCharacter
  85.         GoTo SkipPreviousCheck
  86.     EndIf
  87. EndIf
  88.  
  89. :SkipPreviousCheck
  90.  
  91. If [Win95Only]
  92.     If .not. [WinPlatform] = Win95
  93.         Dialog
  94.             [ProductName] requires Windows 95.
  95.             You must install Windows 95 and then install
  96.             [ProductName].
  97.         EndDialog
  98.     EndIf
  99. EndIf
  100.  
  101. If [PreviousInstall]
  102.       QueLogFile "[InstallationDirectory]\[LogFile]"
  103. EndIf
  104.  
  105. [YesOrNo4] := YesCharacter
  106. ;; Product Introduction Screen
  107. Do FirstInstall
  108.  
  109. If .not. [YesOrNo4]
  110.   GoTo Bail
  111. EndIf
  112.  
  113. Do InstallSystem
  114. Do InstallWinG
  115. Do InstallRMorph
  116.  
  117.  
  118. ;; Do the actual copying
  119. [InstallOption] := BlankString
  120. SetCopyAttrTo 00
  121. CopyQuedFiles LOGFILE "[InstallationDirectory]\[LogFile]" SILENTLY
  122. [Number1] := LastErrorCode
  123. If [Number1] = 1
  124.     [CopyAborted] := YesCharacter
  125.     Dialog BlackOnLightGray
  126.         The installation has been aborted.
  127.         You should run the install program again to either
  128.         complete the installation or to uninstall the
  129.     files that have been installed.
  130.     EndDialog
  131. Else
  132.     If [Number1] = 2
  133.             Dialog BlackOnLightGray
  134.                 Some files could not be overwritten yet because they are
  135.                 in use by other applications. You should restart Windows
  136.                 before running [ProductName] to allow the files to be
  137.                 overwritten.            
  138.             EndDialog
  139.         EndIf
  140. EndIf
  141.  
  142. if [InstallOption] = NoSpace
  143.     Dialog BlackOnLightGray
  144.         You do not have sufficient disk space to run [ProductName].
  145.         You should delete some files on your hard disk and
  146.         then re-insert the CD.
  147.     EndDialog
  148.     GoTo Bail
  149. EndIf
  150.  
  151. CreateLogFile "[InstallationDirectory]\[LogFile]"
  152. Do FillRegister
  153. DeleteCopyQue
  154.  
  155. ;; run the product
  156. Run [InstallationDirectory]\[MainExeName] 
  157.  
  158. ;; run the slideshow
  159. ;;dialog
  160. ;;    Run [InstallFromDirectory]\SLIDES\pptview.exe [InstallFromDirectory]\Slides\Cybslide.ppt    
  161. ;;enddialog
  162. Run [InstallFromDirectory]\SLIDES\pptview.exe [InstallFromDirectory]\Slides\Cybslide.ppt 
  163.  
  164. ;; Automatically uninstall
  165. Do Uninstall
  166.  
  167.  
  168.  
  169. :Bail
  170. SoLong
  171.  
  172.  
  173. Procedure PromptInstallDir
  174.     [InstallationDirectory] := EnvironmentStringFor TEMP
  175.     ValidateInstallDir "[InstallationDirectory]"
  176.     If .not. LastErrorCode = 0
  177.         [TempStr] := FirstFixedDrive
  178.         [InstallationDirectory] := [TempStr]:\TEMP
  179.     EndIf
  180. EndProcedure
  181.  
  182. Procedure FirstInstall
  183.     Do PromptInstallDir
  184.     [Dir1] := [InstallationDirectory]
  185.     Do SecondInstall
  186. EndProcedure
  187.  
  188.  
  189. Procedure Uninstall
  190.     [InstallationDirectory] := RegQueryValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\InstallDir"
  191.     If LastErrorCode = 0
  192.         QueLogFile "[InstallationDirectory]\[LogFile]"
  193.         if LastErrorCode = 0
  194.         ;; uninstall all saved games
  195.             [Number1] := 1
  196.             [Array5] := Reg32EnumValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\SavedGames"
  197.             While [Array5][[Number1]] <> BlankString
  198.                 [TempStr] := [Array5][[Number1]]
  199.                 [String1] := SubStringOf [TempStr] from 1 to 1
  200.                 [String2] := SubStringOf [TempStr] from 4 to End
  201.                 QueCopyFiles from [String1]: DELETE
  202.                     "[String2]"    SavedGame
  203.                 EndQueCopyFiles
  204.                 IncrementNumber [Number1]
  205.             EndWhile
  206.             
  207.             [Number1] := 1
  208.             [Array5] := Reg32EnumValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\Misc"
  209.             While [Array5][[Number1]] <> BlankString
  210.                 [TempStr] := [Array5][[Number1]]
  211.                 [String1] := SubStringOf [TempStr] from 1 to 1
  212.                 [String2] := SubStringOf [TempStr] from 4 to End
  213.                 QueCopyFiles from [String1]: DELETE
  214.                     "[String2]"
  215.                 EndQueCopyFiles
  216.                 IncrementNumber [Number1]
  217.             EndWhile
  218.  
  219.             CopyQuedFiles LOGFILE "[InstallationDirectory]\[LogFile]" Uninstall SILENTLY
  220.         
  221.         Endif
  222.     EndIf
  223.  
  224.     Do EmptyRegister
  225. EndProcedure
  226.  
  227. Procedure SecondInstall
  228.     QueCopyFiles from "[InstallFromDirectory]" to "[InstallationDirectory]"
  229.         CYBER\*.* as *.*
  230.         DATA\SAVEGAME\*.* as SAVEGAME\*.*
  231.         DATA\CYBER.PRF as CYBER.PRF
  232.     EndQueCopyFiles
  233. EndProcedure
  234.  
  235.  
  236. Procedure InstallWinG
  237.     QueCopyFiles from "[InstallFromDirectory]" to "[WindowsSystemDirectory]"
  238.              WING\*.*      as    *.*        SharedDLL
  239.     EndQueCopyFiles
  240. EndProcedure
  241.  
  242. Procedure InstallSystem
  243.         QueCopyFiles from "[InstallFromDirectory]" to "[WindowsSystemDirectory]"
  244.             SYSTEM\*.*      as    *.*               SharedDLL
  245.         EndQueCopyFiles
  246. EndProcedure
  247.  
  248. Procedure InstallMSVC20
  249.         If .not. [WinPlatform] = Win95
  250.             If ([WinPlatform] = Win16) .or. ([WinPlatform] = Win32s)
  251.                 QueCopyFiles from "[InstallFromDirectory]" to "[WindowsSystemDirectory]"
  252.                     MSVCRT20\Win32s\*.*      as    *.*      SharedDLL
  253.                 EndQueCopyFiles
  254.             Else
  255.                 QueCopyFiles from "[InstallFromDirectory]" to "[WindowsSystemDirectory]"
  256.                     MSVCRT20\Win32\*.*      as    *.*   SharedDLL
  257.                 EndQueCopyFiles
  258.             Endif
  259.         EndIf
  260. EndProcedure
  261.  
  262. Procedure InstallRMorph
  263.         QueCopyFiles from "[InstallFromDirectory]" to "[WindowsSystemDirectory]"
  264.            RMORPH\*.*         as    *.*                         SharedDLL
  265.            RMORPH\RL\*.*      as    RL\*.*          SharedDLL
  266.            RMORPH\RL\SOFT\*.* as    RL\SOFT\*.*     SharedDLL
  267.         EndQueCopyFiles
  268. EndProcedure
  269.  
  270.  
  271. Procedure CheckPreviousInstall
  272.     [PrevInstDir] := RegQueryValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\InstallDir"
  273.     If LastErrorCode = 0
  274.         [PreviousInstall] := YesCharacter
  275.         [InstallationDirectory] := [PrevInstDir]
  276.         [TempStr] := RegQueryValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\Language"
  277.         If LastErrorCode = 0
  278. ;;                [Language] := [TempStr]
  279.         EndIf
  280.     EndIf
  281. EndProcedure
  282.  
  283. Procedure FillRegister
  284.     ;; Used by the program
  285. ;;    RegSetValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\ExecDir" "[InstallationDirectory]\[ExecDir]"
  286.         RegSetValue ClassesRoot [RegEntryRoot]\[CompanyName]\[RegEntry]\RootDir "[InstallationDirectory]"
  287.         RegSetValue ClassesRoot [RegEntryRoot]\[CompanyName]\[RegEntry]\BinDir "[InstallationDirectory]\CYBER"
  288.         RegSetValue ClassesRoot [RegEntryRoot]\[CompanyName]\[RegEntry]\LocalDir "[InstallationDirectory]"
  289.         RegSetValue ClassesRoot [RegEntryRoot]\[CompanyName]\[RegEntry]\RemoteDir "[InstallFromDirectory]\DATA"
  290.     ;; Windows 95 only
  291.     ;; Used by Install
  292.     RegSetValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\InstallOption" "[InstallOption]"
  293.     RegSetValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\Language" "[Language]"
  294.     RegSetValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\InstallDir" "[InstallationDirectory]"
  295. ;;      RegSetValue ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]\UnInstallScript" "[InstallationDirectory]\[UninstallScript]"
  296. EndProcedure
  297.  
  298.  
  299. Procedure EmptyRegister
  300. ;;      RegDeleteKey ClassesRoot [RegAppID]
  301.         RegDeleteKey ClassesRoot "[RegEntryRoot]\[CompanyName]\[RegEntry]"
  302.  
  303.         ;; check to see if there are any other products under this company name
  304.         ;; if not, then delete this entry too
  305.         [Array5] := RegEnumKey ClassesRoot "[RegEntryRoot]\[CompanyName]"
  306.         If .not. LastErrorCode = 0
  307.             RegDeleteKey ClassesRoot "[RegEntryRoot]\[CompanyName]"
  308.         EndIf
  309. EndProcedure
  310.  
  311. EndScript
  312.