home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Script: AdminOptions.vbs
- '
- ' Notes: - used to attach add temporary component, and set [INSTALLDIRRES]
- '
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
- Const msidbComponentAttributesLocalOnly = "0"
- Const sComponentLocalOnly = "NetworkLocalOnly"
- Const sComponentLocalOnlyGUID = "{F3D81E0D-E119-49B8-970F-E5ECCF2CE6FF}"
-
- Const msidbComponentAttributesSourceOnly = "1"
- Const sComponentSourceOnly = "NetworkSourceOnly"
- Const sComponentSourceOnlyGUID = "{A4EB7609-2550-4BAD-ABBB-88393039B86D}"
-
- Const msidbComponentAttributesOptional = "2"
- Const sComponentOptional = "NetworkOptional"
- Const sComponentOptionalGUID = "{69E2C3F6-A69F-4B59-A42E-C1CA7E343D6D}"
-
- Const sParentFeatureName = "WordPerfectSuite"
- Const sNetworkFeatureName = "NetworkFeature"
-
- Const msiNoAction = -1
- Const msiInstallStateAdvertise = 1
- Const msiInstallStateAbsent = 2
- Const msiInstallStateLocal = 3
- Const msiInstallStateSource = 4
- Const msiInstallStateDefault = 5
-
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Sub: setAdminInstallOpt
- '
- ' Notes: - gets AdminProperty NETWORKOPTS
- ' - attaches the correct Network<Component> sParentFeatureName
- ' - its attrbute sets the top features remote installation, and ...
- ' the rest of the features follow parent
- ' - the .msi's components should be authored to install Optional by default
- ' before CostInitialize in both InstallUISequence, and InstallExecuteSequence
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Sub setAdminInstallOpt
-
- Dim sComponent: sComponent = sComponentLocalOnly
- Dim sAdminOption: sAdminOption = Session.Property("ADMINOPTIONS")
- Dim nFeatureState
-
- If (Session.Property("IsAdminPackage") <> "") Then
- Select Case sAdminOption
- Case msidbComponentAttributesSourceOnly
- sComponent = sComponentSourceOnly
- nFeatureState = msiInstallStateSource
-
- Case msidbComponentAttributesOptional
- sComponent = sComponentOptional
-
- Case msidbComponentAttributesLocalOnly
- sComponent = sComponentLocalOnly
- End Select
- End If
-
- ' Attacth the correct NetworkComponent to sParentFeatureName
- Dim sQuery
- sQuery = "INSERT INTO `FeatureComponents` (`Feature_`, `Component_`) " & _
- "VALUES ('" & sParentFeatureName & "', '" & sComponent & "') " & _
- "TEMPORARY"
-
- ExecuteQuery sQuery
-
- End Sub
-
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Sub: ExecuteQuery (STRING)
- '
- ' Arg(s): sSQL = a sql query
- '
- ' Returns: A record object of the view executed
- '
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Sub ExecuteQuery(sSQL)
-
- Dim view: Set view = Session.Database.OpenView(sSQL)
- view.Execute
-
- End Sub
-
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Sub: setInstallDirRes
- '
- ' Note(s): sets [INSTALLDIRRES] to optional required component sComponentOptionalGUID
- ' sComponentOptional is required and always installed
- ' custom action should only be called when ($sComponentOptional <= 2)
- '
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Sub setInstallDirRes
- Dim sPath: sPath = ""
- Dim nState: nState = Session.FeatureRequestState(sNetworkFeatureName)
-
- If (nState = msiInstallStateLocal) Then
- 'Local install
- sPath = Session.Property("INSTALLDIR")
-
- ElseIf (nState = msiInstallStateSource) Then
- 'run from source install
- sPath = Session.SourcePath("INSTALLDIR")
- End If
-
- If (sPath <> "") Then
- Session.TargetPath("INSTALLDIRRES") = sPath
- End If
- End Sub
-
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Sub: setInstallDirRes
- '
- ' Note(s): sets [INSTALLDIRRES] to optional required component sComponentOptionalGUID
- ' sComponentOptional is required and always installed
- ' custom action should only be called when ($sComponentOptional <= 2)
- '
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Sub setInstallDirRes
-
- On Error Resume Next
-
- Dim objInstaller: Set objInstaller = CreateObject("WindowsInstaller.Installer")
- Dim sProductCode: sProductCode = Session.Property("ProductCode")
-
- Dim sPath: sPath = ""
- Dim nState: nState = Session.FeatureRequestState(sNetworkFeatureName)
-
- If (nState = msiInstallStateLocal) Then
- 'Local install
- sPath = Session.Property("INSTALLDIR")
-
- ElseIf (nState = msiInstallStateSource) Then
- 'run from source install
- sPath = Session.SourcePath("INSTALLDIR")
-
- ElseIf ((nState = msiNoAction) OR (nState = msiInstallStateDefault)) Then
- ' Already install, not changing locations
- Session.Property("INSTALLDIRRES") = objInstaller.ComponentPath(sProductCode, sComponentOptionalGUID)
-
- End If
-
- If (sPath <> "") Then
- Session.Property("INSTALLDIRRES") = sPath
- Session.Property("PROGRAMSRES") = sPath & "Programs"
- End If
- End Sub
-
-