Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Create Transform in vbscript


2 replies to this topic

comecme

comecme
  • Members
  • 30 posts

Posted 04 November 2003 - 22:51

I'm trying to write a vbscript that will create a transform in which all components get a Remote Installation value of Optional. So far, I've only been able to alter an existing MSI-file, and then create a MST of the differences with my original MSI.

When I use a tool like InstallShield Developer however, I can create a MST directly. Or is the interface just making me believe I am changing a transform and is it actually modifying a copy of the MSI?

The only methods I could find in the SDK documentation (CreateTransformSummaryInfo and GenerateTransform) create a transform by comparing two MSI's, and that is not what I'm trying to do. I'd like to create and/or edit the MST directly. Can it be done?
Dick Nagtegaal

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 November 2003 - 10:34

I don't think you can. I'm pretty sure any tool that lets you create a transform directly actually uses an msi behind the scenes.

comecme

comecme
  • Members
  • 30 posts

Posted 08 November 2003 - 21:30

OK, so I'll use a MSI. Then I run into another problem. Now I'm not creating a MST from scratch, but I want to change an exising MST. So I copy my MSI and apply the existing transform to it. Then I make my changes to the copied MSI. After that, I want to recreate the transform, by calling the GenerateTransform function.

My code looks like this:
CODE
Set installer = Wscript.CreateObject("WindowsInstaller.Installer")
' Copy "Test.msi" to "Copy of Test.msi"
Set orgdatabase = installer.OpenDatabase("Test.msi", 0)
Set database = installer.OpenDatabase("Copy of Test.msi", 2)
database.ApplyTransform "Test.mst", 0
' Make some changes to database
database.GenerateTransform orgDatabase, "Test.mst"

When I run this script, I get an error message on the GenerateTransform. The message is a Msi API Error with code 0x080004005 in GenerateTransform,ReferenceDatabase,Transformfile.

I've been able to work adourn this by adding the following line just before the GenerateTransform
CODE
Set database = Nothing: Set database = installer.OpenDatabase("Copy of Test.msi", 2)

It seems like the ApplyTransform opens Test.mst and keeps it open. Any ideas on a way to close only the mst and keep the msi open? It seems silly I'd have to close and reopen my msi for something like this. I also haven't been able to find any info on the error message itself. Where would I find what the message means?

Edited by comecme, 09 November 2003 - 00:15.

Dick Nagtegaal