/build/static/layout/Breadcrumb_cap_w.png

When are Featurestates updated?

First off I am using Wise Installation Studio to make my installer and using their default dialogs etc. I don't know if that helps. I want to be able to save what features the user has decided to install or not install during a custom installation. At what point in the installation sequence is the FeatureState updated with the user's changes? I assume I will need to place my custom action after this to save the feauture state?

0 Comments   [ + ] Show comments

Answers (2)

Posted by: AngelD 15 years ago
Red Belt
0
May I ask why you need to know?
Posted by: jmcfadyen 15 years ago
5th Degree Black Belt
0
this should give you the detail you want



Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal = 3
Const msiInstallStateSource = 4
Const msiInstallStateDefault = 5
strSourceDir = session.property("INSTALLDIR")
sLogFile = "d:\setups\Install.log"
sXmlFile = "d:\setups\" & trim(session.property("ProductName")) & ".xml"
Set oInstaller = session.installer
Set oShell = CreateObject("Wscript.Shell")
Set oXmlDoc= CreateObject("Microsoft.XMLDOM")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oLogfile = oFSO.CreateTextFile(sLogFile, ForWriting)
oXmlDoc.PreserveWhiteSpace = True
Set oXmlPI = oXmlDoc.CreateProcessingInstruction("xml", "version=""1.0""")
oXmlDoc.AppendChild(oXmlPI)
Set oXmlRoot = oXmlDoc.CreateElement("Environment")
oXmlDoc.AppendChild(oXmlRoot)
Set oNodeInstallDetails = oXmlDoc.CreateElement("InstallDetail")
oXmlRoot.AppendChild(oNodeInstallDetails)
Set oNodeAppDetails = oXmlDoc.CreateElement("PackageDetail")
oXmlRoot.AppendChild(oNodeAppDetails)
Set oNodeComponents = oXmlDoc.CreateElement("Components")
oNodeAppDetails.AppendChild(oNodeComponents)
Set oNodeCustomAction = oXmlDoc.CreateElement("CustomActions")
oNodeAppDetails.AppendChild(oNodeCustomAction)
AddNodeAttribute oNodeAppDetails, "ApplicationName", session.property("ProductName")
AddNodeAttribute oNodeAppDetails, "ApplicationVersion", session.property("ProductVersion")
AddNodeAttribute oNodeInstallDetails, "ApplicationInstaller", session.property("%Username")
AddNodeAttribute oNodeInstallDetails, "InstallDate", date
AddNodeAttribute oNodeInstallDetails, "InstallLocation", session.property("%Computername")
sUsername = oShell.ExpandEnvironmentStrings("%USERNAME%")
Set oView = session.database.openview("Select * FROM File")
oView.Execute
Do
Set oRecord = oView.Fetch
if oRecord is nothing then
exit do
end if
sComponent = oRecord.StringData(2)
cComponentState = session.componentRequestState(sComponent)

If session.componentRequestState(sComponent) > 1 Then
sFilePath = "[#" & oRecord.StringData(1) & "]"
sFilePathValue = FormatRecord(sFilePath)

sCompFldr = "[$" & oRecord.StringData(2) & "]"
sCompFldrValue = FormatRecord(sCompFldr)
sFileSize = oRecord.StringData(4)
sFileVersion = oRecord.StringData(5)
oLogFile.Writeline "FilePath: " & sCompFldrValue
oLogFile.Writeline "FileFldr: " & sFilePathValue
oLogFile.Writeline ""

CreateFile oRecord.StringData(2), sFilePathValue, sCompFldrValue, sFileSize, sFileVersion
'
End If
Loop
Set oView1 = session.database.openview("Select Action FROM CustomAction")
oView1.Execute
Do
Set oRecord1 = oView1.Fetch
If oRecord1 Is Nothing Then
exit do
end if
sActionName = oRecord1.StringData(1)

Set oView2 = session.database.openview("Select Condition FROM InstallExecuteSequence WHERE Action ='" & sActionName & "'")
oView2.Execute
Do
Set oRecord2 = oView2.Fetch
If oRecord2 Is Nothing Then
Exit Do
End If

intResult = session.evaluateCondition(oRecord2.StringData(1))

If IntResult = 1 Or intResult = 2 Then
Set oNodeNewCA = oXmlDoc.CreateElement("CA")
oNodeCustomAction.AppendChild(oNodeNewCA)
AddNodeAttribute oNodeNewCA, "Name", oRecord1.StringData(1)
AddNodeAttribute oNodeNewCA, "Condition", oRecord2.StringData(1)
End If

Loop
Loop
oXmlDoc.Save(sXmlFile)
'********************************************************************************
' Function: MSI Format Record
'
' Inputs: sRecordName
'
' Output: Resolved record value
'
'--------------------------------------------------------------------------------
Function FormatRecord(sRecordName)
On Error Resume Next
Set oFormatRecord = oInstaller.CreateRecord(1)
oFormatRecord.ClearData
oFormatRecord.StringData(0) = sRecordName
FormatRecord = Session.FormatRecord(oFormatRecord)
Set oFormatRecord = Nothing
'
end function
'********************************************************************************
' Function: XMLNodeExists
'
' Inputs: sXQuery
'
' Output: Boolean value to see of node is present
'
'--------------------------------------------------------------------------------
Function XMLNodeExists(sXQuery)
XMLNodeExists = True
Set oExistNode = oXmlDoc.DocumentElement.SelectSingleNode(sXQuery)
If oExistNode Is Nothing Then XMLNodeExists = False
set oExistNode = Nothing
End function
'********************************************************************************
' Function: Create XML Component Node
'
' Inputs: sNode - name of XML Component node to create
'
' Output: none
'
'--------------------------------------------------------------------------------
Function CreateComponent(sNode)
If Not XMLNodeExists("//Environment/PackageDetail/Components/" & sNode) Then
Set oNodeNewComponent = oXmlDoc.CreateElement(sNode)
oNodeComponents.AppendChild(oNodeNewComponent)
else
set oNodeNewComponent = oXmlDoc.SelectSingleNode("//Environment/PackageDetail/Components/" & sNode)
end if
set CreateComponent = oNodeNewComponent
set oNodeNewComponent = nothing
End function
'********************************************************************************
' Function: CreateFile
'
' Inputs: sComp - Component node to add file detail to
' sFile - File name details
' sFolder - File folder path
' sFileSize - File size
' sFileVersion - File version
'
' Output: none yet
'
'--------------------------------------------------------------------------------
Function CreateFile(sComp, sFile, sFolder, sFileSize, sFileVersion)

set oNodeCurrentComponent = CreateComponent(sComp)
Set oNodeNewFile = oXmlDoc.CreateElement("File")
oNodeCurrentComponent.AppendChild(oNodeNewFile)
AddNodeAttribute oNodeNewFile, "Filename", sFile
AddNodeAttribute oNodeNewFile, "Filedir", sFolder
AddNodeAttribute oNodeNewfile, "Filesize", sFileSize
AddNodeAttribute oNodeNewfile, "FileVersion", sFileVersion
set oNodeCurrentComponent = nothing
set oNodeNewFile = nothing
End function
'********************************************************************************
' Function: AddNodeAttribute
'
' Inputs: oNode - XML Node to add stuff into.
' sAttName - Attribute name to add
' sValue - Attribute value to add
'
' Output: Resolved record value
'
'--------------------------------------------------------------------------------
Function AddNodeAttribute(oNode, sAttName, sValue)
set oAttrib = oXmlDoc.CreateAttribute(sAttName)
oAttrib.Value = sValue
oNode.Attributes.SetNamedItem oAttrib
End Function

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ