This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Automation using Powershell - solved
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Oct 29, 2009
08:01 AM
Automation using Powershell
I have an installation proram (Basic MSI) with 20,000 + files, my problem is knowing if I have added all the files compared to what is in the folder. This started me off on Powershell where I now get a list of all the files under a directory structure and compare them to those in my project.....all the files I haven't added are just listed in a text file.
This was a start in the right direction so I thought I'd clear all of my files in my components (except perhaps the key file) and then run a Powershell script to add the file prior to the compile.
If I use VB/VBA/VBScript : (Very simple example) This works a treat and file APSP52.RS is added and I could optionally make it the key as well.
Dim obj As New ISWiAuto16.ISWiProject
x = obj.OpenProject("C:\InstallShield 2010 Projects\test.ism", False)
Set Comps = obj.ISWiComponents
Set Screensobj = Comps("Screens")
Screensobj.AddFile ("C:\TESTFILES\APSP52.RS")
'Screensobj.KeyPathType = 2
'Screensobj.KeyPath = "apsp52.rs"
obj.SaveProject
obj.CloseProject
Set obj = Nothing
But when I do the same thing in Powershell is doen't seem to save the file I don't seem to get any errors.
Where have I one wrong?
cls
$Drive = "C:\"
$BuildFolder = "TESTFILES\SCREENS"
cd $Drive
cd $BuildFolder
echo "Start"
echo "Get file list"
# $files = dir -Recurse | where {$_.psIsContainer -ne $true}
echo "Open poject $($TheInstallshieldProject)"
$TheInstallshieldProject = "C:\InstallShield 2010 Projects\test.ism"
# $oneInstallshieldProject = New-Object -comobject ("ISWiAuto16.ISWiProject")
$oneInstallshieldProject = New-Object -com ISWiAuto16.ISWiProject
$x = $oneInstallshieldProject.OpenProject($TheInstallshieldProject)
echo "File open status : $($x)"
$aComponentCollection = $oneInstallshieldProject.ISWiComponents
$t = $aComponentCollection.count
echo "Component Count : $($t)"
foreach($Component in $aComponentCollection)
{
if ($Component.Name -eq "Screens")
{
# ForEach ($file in $files)
# {
$Component.AddFile("C:\TESTFILES\APSP52.RS")
# }
}
}
$oneInstallshieldProject.SaveProject
$oneInstallshieldProject.CloseProject
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($oneInstallshieldProject)
$oneInstallshieldProject = $null
This was a start in the right direction so I thought I'd clear all of my files in my components (except perhaps the key file) and then run a Powershell script to add the file prior to the compile.
If I use VB/VBA/VBScript : (Very simple example) This works a treat and file APSP52.RS is added and I could optionally make it the key as well.
Dim obj As New ISWiAuto16.ISWiProject
x = obj.OpenProject("C:\InstallShield 2010 Projects\test.ism", False)
Set Comps = obj.ISWiComponents
Set Screensobj = Comps("Screens")
Screensobj.AddFile ("C:\TESTFILES\APSP52.RS")
'Screensobj.KeyPathType = 2
'Screensobj.KeyPath = "apsp52.rs"
obj.SaveProject
obj.CloseProject
Set obj = Nothing
But when I do the same thing in Powershell is doen't seem to save the file I don't seem to get any errors.
Where have I one wrong?
cls
$Drive = "C:\"
$BuildFolder = "TESTFILES\SCREENS"
cd $Drive
cd $BuildFolder
echo "Start"
echo "Get file list"
# $files = dir -Recurse | where {$_.psIsContainer -ne $true}
echo "Open poject $($TheInstallshieldProject)"
$TheInstallshieldProject = "C:\InstallShield 2010 Projects\test.ism"
# $oneInstallshieldProject = New-Object -comobject ("ISWiAuto16.ISWiProject")
$oneInstallshieldProject = New-Object -com ISWiAuto16.ISWiProject
$x = $oneInstallshieldProject.OpenProject($TheInstallshieldProject)
echo "File open status : $($x)"
$aComponentCollection = $oneInstallshieldProject.ISWiComponents
$t = $aComponentCollection.count
echo "Component Count : $($t)"
foreach($Component in $aComponentCollection)
{
if ($Component.Name -eq "Screens")
{
# ForEach ($file in $files)
# {
$Component.AddFile("C:\TESTFILES\APSP52.RS")
# }
}
}
$oneInstallshieldProject.SaveProject
$oneInstallshieldProject.CloseProject
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($oneInstallshieldProject)
$oneInstallshieldProject = $null
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Oct 30, 2009
01:52 AM
After much pain I got this to work with just a few line changes....the main problem was the missing ()
$q = $oneInstallshieldProject.SaveProject()
echo "Project saved status : $($x)"
$q= $oneInstallshieldProject.CloseProject()
echo "Project closed status : $($x)"
$q = $oneInstallshieldProject.SaveProject()
echo "Project saved status : $($x)"
$q= $oneInstallshieldProject.CloseProject()
echo "Project closed status : $($x)"