mossi
Posts: 12
Joined: Thu Oct 09, 2008 9:55 am

Difficulties using properties

Hi,

I set a bunch of properties to be used by custom actions in InstallExecuteSequence|Begin (e.g. file names of drivers for different OS variants)
and properties to identify the OS (W2K, WXP 32, WXP64, Vista32, Vista64...) using conditions.

Works fine for "install".

But when I use these properties for uninstall, they are NOT set/updated.
So I moved them to InstallUISequence. Then uninstall works (properties are set) ONLY when re-invoking setup exe | modify | REMOVE.

Uninstalling via Control Panel | Add Remove Programs fails, as the properties don't get set.

Question 1: Is there a place where I can put the custom actions to be run before install execute AND uninstall execute?

Question2: If not, I can write the 2 or 3 values I need to the registry, BUT how do I get these values back into a property before the
custom action in Uninstall is performed??

Any help appreciated,
Axel
mossi
Posts: 12
Joined: Thu Oct 09, 2008 9:55 am

Re: Difficulties using properties

Hi,

I solved / worked around question 2:

I store the needed properties in hthe registry during install.
Then I added a custom action at the beginning of uninstall, using a vb Script to get and set the needed properties.

Code: Select all

Function SetOSDependentProperties()  

   Dim WShell, PROP1, PROP2, PROP3
   Dim Property
   
   const RegPath = "SOFTWARE\MyCompany\ProductName\"

   strKeyPath      = RegPath32
   RegEntry        = "HKEY_LOCAL_MACHINE\" & strKeyPath 


   Set WShell = CreateObject("WScript.Shell")
   PROP1 = WShell.RegRead(RegEntry & "PropertyName1");
   PROP2 = WShell.RegRead(RegEntry & "PropertyName2");
   PROP3 = WShell.RegRead(RegEntry & "PropertyName3");

   Session.Property("PROP1") = PROP1
   Session.Property("PROP2") = PROP2
   Session.Property("PROP3") = PROP3

End Function   
Works nice. But I still would like to knew whether there's a smarter way by just moving the custom actions to the right place.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Difficulties using properties

Hi,

The properties used by your installation can be set after "InstallExecuteSequence" -> "Begin". However, these properties will be available only to the current install process. If you want to use the same values during an uninstall, you can use the approach explained in the Make the properties keep their values during Maintenance how-to.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mossi
Posts: 12
Joined: Thu Oct 09, 2008 9:55 am

Re: Difficulties using properties

Hi Cosmin,

yeah nice solution. I'll try that. Like that, because I don't need a script...

Thanks,
Axel

Return to “Common Problems”