Hi all, as I'm finding that we're straying further into languages that people use for automation and system management, I felt that a good complement was providing an example in AutoIT, something frequently used for Unit testing.
COM libraries, iterators, etc. are all built-in and so it seems that there's no need for any external dependencies. Very clean!
ISWiFeatures
This example illustrates iterating through root-level features and components.
$m_ISWiProj = ObjCreate("IswiAuto17.ISWiProject")
$strFile = "C:InstallShield 2011 ProjectsMY 64 bit Project.ism"
$m_ISWiProj.OpenProject($strFile)
$strProject = ""
For $m_Feature In $m_ISWiProj.ISWiFeatures
$strProject = $strProject &"Feature: " & $m_Feature.Name & @CRLF
$strProject = $strProject &"Components: "
For $m_Component In $m_Feature.ISWiComponents
$strProject = $strProject & $m_Component.Name & " "
Next
Next
ConsoleWrite($strProject & @CRLF)
$m_ISWiProj.CloseProject()
ISWiComponents
This example illustrates getting a specific feature from the ISWiFeatures collection, and using it to set component properties, and then saving the project.
Const $rfsLocal = 0
Const $rfsSource = 1
Const $rfsOptional = 2
$m_ISWiProj = ObjCreate("IswiAuto17.ISWiProject")
$strFile = "C:InstallShield 2011 ProjectsMY 64 bit Project.ism"
$m_ISWiProj.OpenProject($strFile)
$m_Feature = $m_ISWiProj.ISWiFeatures("MyApplication")
For $m_Component In $m_Feature.ISWiComponents
$m_Component.RemoteInstallation = $rfsSource
Next
$m_ISWiProj.SaveProject()
$m_ISWiProj.CloseProject()