home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / downloads / 401065 / WPO11 / WPO11.msi / Binary.NewBinary26 < prev    next >
Text File  |  2003-04-15  |  5KB  |  153 lines

  1. Option Explicit
  2. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  3. '    Script:    AdminOptions.vbs
  4. '
  5. '    Notes:    - used to attach add temporary component, and set [INSTALLDIRRES]
  6. '
  7. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  8.  
  9. Const msidbComponentAttributesLocalOnly = "0"
  10. Const sComponentLocalOnly = "NetworkLocalOnly"
  11. Const sComponentLocalOnlyGUID = "{F3D81E0D-E119-49B8-970F-E5ECCF2CE6FF}"
  12.  
  13. Const msidbComponentAttributesSourceOnly = "1"
  14. Const sComponentSourceOnly = "NetworkSourceOnly"
  15. Const sComponentSourceOnlyGUID = "{A4EB7609-2550-4BAD-ABBB-88393039B86D}"
  16.  
  17. Const msidbComponentAttributesOptional = "2"
  18. Const sComponentOptional = "NetworkOptional"
  19. Const sComponentOptionalGUID = "{69E2C3F6-A69F-4B59-A42E-C1CA7E343D6D}"
  20.  
  21. Const sParentFeatureName = "WordPerfectSuite"
  22. Const sNetworkFeatureName = "NetworkFeature"
  23.  
  24. Const msiNoAction = -1
  25. Const msiInstallStateAdvertise = 1
  26. Const msiInstallStateAbsent = 2
  27. Const msiInstallStateLocal = 3
  28. Const msiInstallStateSource = 4
  29. Const msiInstallStateDefault = 5
  30.  
  31.  
  32. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  33. '    Sub:    setAdminInstallOpt
  34. '
  35. '    Notes:    - gets AdminProperty NETWORKOPTS
  36. '        - attaches the correct Network<Component> sParentFeatureName
  37. '        - its attrbute sets the top features remote installation, and ...
  38. '            the rest of the features follow parent
  39. '        - the .msi's components should be authored to install Optional by default
  40. '            before CostInitialize in both InstallUISequence, and InstallExecuteSequence
  41. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  42. Sub setAdminInstallOpt
  43.  
  44.     Dim sComponent: sComponent = sComponentLocalOnly
  45.     Dim sAdminOption: sAdminOption = Session.Property("ADMINOPTIONS")
  46.     Dim nFeatureState
  47.  
  48.     If (Session.Property("IsAdminPackage") <> "") Then
  49.         Select Case sAdminOption
  50.             Case msidbComponentAttributesSourceOnly
  51.                 sComponent = sComponentSourceOnly
  52.                 nFeatureState = msiInstallStateSource
  53.  
  54.             Case msidbComponentAttributesOptional
  55.                 sComponent = sComponentOptional
  56.  
  57.             Case msidbComponentAttributesLocalOnly
  58.                 sComponent = sComponentLocalOnly
  59.         End Select
  60.     End If
  61.  
  62.     ' Attacth the correct NetworkComponent to sParentFeatureName
  63.     Dim sQuery
  64.     sQuery = "INSERT INTO `FeatureComponents` (`Feature_`, `Component_`) " & _
  65.         "VALUES ('" & sParentFeatureName & "', '" & sComponent & "') " & _
  66.         "TEMPORARY"
  67.  
  68.     ExecuteQuery sQuery
  69.  
  70. End Sub
  71.  
  72.  
  73. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  74. '    Sub:    ExecuteQuery (STRING)
  75. '
  76. '    Arg(s):    sSQL = a sql query
  77. '
  78. '    Returns:    A record object of the view executed
  79. '
  80. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  81. Sub ExecuteQuery(sSQL)
  82.  
  83.     Dim view: Set view = Session.Database.OpenView(sSQL)
  84.     view.Execute
  85.     
  86. End Sub
  87.  
  88.  
  89. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  90. '    Sub:    setInstallDirRes
  91. '
  92. '    Note(s):     sets [INSTALLDIRRES] to optional required component sComponentOptionalGUID
  93. '            sComponentOptional is required and always installed
  94. '            custom action should only be called when ($sComponentOptional <= 2)
  95. '
  96. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  97. Sub setInstallDirRes
  98.     Dim sPath: sPath = ""
  99.     Dim nState: nState = Session.FeatureRequestState(sNetworkFeatureName)
  100.  
  101.     If (nState = msiInstallStateLocal) Then
  102.         'Local install
  103.         sPath = Session.Property("INSTALLDIR")
  104.         
  105.     ElseIf (nState = msiInstallStateSource) Then
  106.         'run from source install
  107.         sPath = Session.SourcePath("INSTALLDIR")
  108.     End If
  109.  
  110.     If (sPath <> "") Then
  111.         Session.TargetPath("INSTALLDIRRES") = sPath
  112.     End If
  113. End Sub
  114.  
  115. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  116. '    Sub:    setInstallDirRes
  117. '
  118. '    Note(s):     sets [INSTALLDIRRES] to optional required component sComponentOptionalGUID
  119. '            sComponentOptional is required and always installed
  120. '            custom action should only be called when ($sComponentOptional <= 2)
  121. '
  122. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  123. Sub setInstallDirRes
  124.  
  125. On Error Resume Next
  126.  
  127.     Dim objInstaller: Set objInstaller = CreateObject("WindowsInstaller.Installer")
  128.     Dim sProductCode: sProductCode = Session.Property("ProductCode")
  129.  
  130.     Dim sPath: sPath = ""
  131.     Dim nState: nState = Session.FeatureRequestState(sNetworkFeatureName)
  132.  
  133.     If (nState = msiInstallStateLocal) Then
  134.         'Local install
  135.         sPath = Session.Property("INSTALLDIR")
  136.         
  137.     ElseIf (nState = msiInstallStateSource) Then
  138.         'run from source install
  139.         sPath = Session.SourcePath("INSTALLDIR")
  140.  
  141.     ElseIf ((nState = msiNoAction) OR (nState = msiInstallStateDefault)) Then
  142.         ' Already install, not changing locations
  143.         Session.Property("INSTALLDIRRES") = objInstaller.ComponentPath(sProductCode, sComponentOptionalGUID)
  144.  
  145.     End If
  146.  
  147.     If (sPath <> "") Then
  148.         Session.Property("INSTALLDIRRES") = sPath
  149.         Session.Property("PROGRAMSRES") = sPath & "Programs"
  150.     End If
  151. End Sub
  152.  
  153.