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.

Modify CustomActions Dynamically

3 replies to this topic


  • Full Members
  • 44 posts

Posted 19 January 2007 - 11:52

Hi all

I am using IS 7 Developer SP4
I am using Pure Basic MSI ( no IS scripts)

Is there any way to modify the CustomActions dyanamically.. that is using Automation Scripts ..

I just read in article that we can count the number of CA present and fetch the names of CA and even change the name of CA dyanamically (i.e through Vb script) and i tested one and it is changing the name of CA
the code i have written here

Set pProject = CreateObject("ISWiAutomation.ISWiProject")
pProject.OpenProject "C:\Documents and Settings\abc\My Documents\MySetups\DyanamicCA\one.ism", True '
sNames = "This project contains the following custom actions:"
iCount = pProject.ISWiCustomActions.Count
For i = 1 to iCount
sNames = pProject.ISWiCustomActions(i).Name

Now my question is can we change CA property FileName & CommandLine dynamically. I know we can change Name of CustomeAction and also other properties like ProductCode PackageCode etc using Set oISM = CreateObject("ISWiAutomation.ISWiProject") oISM.ProductName="New Name" etc

The requirement was such that we are dynamically including a .dll and later we have to register it. To register a dll whose name is not known and can only be known during build time when the dll name is passed to vb script which builds the .ism file. The CA has to pick this passed dll value and register it using RunDLL32 "Path of dll\dllname.dll" RegisterPlugin. Now the dllname.dll will change on each build. How to pass this as a parameter to CA??

I think i am extending in this forum ..
if someone understood my requirement, please feel free to clerify if i am not able to put properly

thanks in advance


  • Full Members
  • 44 posts

Posted 22 January 2007 - 05:25

Please some body show me the light..

Is it possible to change the filename and Working directory of the CA from outside..i.e. through scripts Automation object
its urgent...

thanks in advance.

Stefan Krueger

Stefan Krueger


  • Administrators
  • 13,269 posts

Posted 23 January 2007 - 15:48

I'm not sure if it's possible using iswi automation, but the .ism file format is either XML (if you selected so) or binary, which means the same as a .msi file. In both cases you can modify the information in the ism file directly, either using some XML tool or using Msi automation.
You need to be sure what you're doing of course, don't break the referencial integrity of the MSI database etc.


  • Full Members
  • 44 posts

Posted 24 January 2007 - 05:36

Thanks Stephan..
i am able to do that ....

the code i have used is ( this is for other users also who encounter the same issue)
correct me if i am wrong..

Set oMSI = CreateObject("WindowsInstaller.Installer")

' open ISM file in transacted mode

Set oDB = oMSI.OpenDatabase("Plugin.ism", 1)

Set oView = oDB.OpenView("SELECT * FROM `CustomAction` WHERE `Action`='RPlugin'")
Set oRec = oView.Fetch

' change field 4, the Value field cFCL is a varible to hold value of Filename and Commandline
oRec.StringData(4) = "RunDll32 """+vFCL +""" RegisterPlugin"
MsgBox oRec.StringData(4)

' update the changed record
oView.Modify 2, oRec

' close the view, commit changes, clean up