How to tick-off a checkbox when its variable is a string filled with a path?

Apr 8, 2013 at 3:21 PM
Hi Neil, nice ba I must say! Also your numerous discussions with the Wix team gave me a lot of the needed insight concerning setups.

I've hit a challenge, I was expecting that the checkbox would be checked whenever I feed it a string value that is not empty. Maybe I'm just doing it wrong. But I'd like to tick an option when an installed path was found in the registry.

Based on the Bundle4 example, I have the following in my bundle.wxs:
<Variable Name="Noah4.0_32Bit" Type="string" Value="" Persisted="yes" bal:Overridable="yes" />
    <util:RegistrySearch Id="Noah4Path32Bit"
                         Root="HKLM" Win64="no"
                         Key="SOFTWARE\HIMSA\Installationinfo\Noah\v4"
                         Value="InstallPath"
                         Variable="Noah4.0_32Bit"/>
And the following in my theme.xml:
<Checkbox Name="Noah4.0_32Bit"  X="185" Y="211" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">Noah4.0_32Bit</Checkbox>
I'm used to that checkboxes, when tied to strings, will accept any non-empty string as being TRUE. But that might be a wrong assumption from my side, I tried conditional setting of a numeric variable but in vain, seems that that is only possible in Wix MSI. (FYI: I verified the variable using a textbox and my other checkboxes are using numeric variables which all work as advertised)

Thanks in advance, Joshua Krosenbrink
Coordinator
Apr 8, 2013 at 3:50 PM
Unfortunately it only works with numeric variables, so if you define Noah4.0_32Bit as a numeric variable and then use the Result="exists" attribute on your registry search it should work.
Apr 8, 2013 at 4:01 PM
Problem is that NOAH is a 3rd party product... I can't tell them to change their registry keys. I'm afraid I have to find another way.

Thanks for the info though and the very prompt reply!
Coordinator
Apr 8, 2013 at 4:37 PM
You don't have to change the other product:
<Variable Name="Noah4.0_32Bit" Type="numeric" Value="0" Persisted="yes" bal:Overridable="yes" />
<util:RegistrySearch Id="Noah4Path32Bit"
                     Root="HKLM" Win64="no"
                     Key="SOFTWARE\HIMSA\Installationinfo\Noah\v4"
                     Value="InstallPath"
                     Variable="Noah4.0_32Bit" Result="exists" />
Note: the variable type is now numeric and the search uses Result="exists".
Apr 8, 2013 at 5:35 PM
Edited Apr 8, 2013 at 5:36 PM
Exactly my initial thought, but sadly the 3rd party developers write an empty Value to that InstallPath entry when uninstalling. You can see now, that 'exists' will always return TRUE, (because it exists although empty).

Currently modified a small part of "WixBalExtension.dll" that contains the checkbox functionality, not sure how I'm gonna debug my changes, haven't found a way yet. So far it seems like nothing changed...
Coordinator
Apr 8, 2013 at 5:49 PM
It is a shame when installs are not written correctly, the easiest option is to use the bafunction extension and hook in to the OnDetect method - it was written for just these scenarios.
Apr 9, 2013 at 1:32 PM
Edited Apr 9, 2013 at 1:33 PM
Thanks for the pointer!

Wish deployment was taken as serious by others as we do, guess I should bill them the 3 days extra work ;) But in the end I had to evade to a simpler solution due to deadlines. So it is sort of working for me now:
    <Variable Name="InstallNoah4Module" Type="numeric" Value="0" Persisted="yes" bal:Overridable="yes" />

    <!-- Find NOAH 4.1 installed key -->
    <util:RegistrySearch Id="findnoah41key" 
                         Root="HKLM" 
                         Key="SOFTWARE\HIMSA\Installationinfo\Noah\v4"
                         Value="Installed"
                         Result="exists"
                         Variable="HasNoah41Key"/>

    <!-- Find NOAH 4.1 installed flag -->
    <util:RegistrySearch Id="getnoah41flag" 
                         After="findnoah41key"
                         Condition="HasNoah41Key"
                         Root="HKLM"
                         Key="SOFTWARE\HIMSA\Installationinfo\Noah\v4"
                         Value="Installed"
                         Variable="InstallNoah4Module"/>
    
    <!-- Find old NOAH 4.0 in 32 bit reg when NOAH 4.1 doesn't exist -->
    <util:RegistrySearch Id="findnoah40x86" 
                         After="findnoah41key"
                         Condition="HasNoah41Key = 0"
                         Root="HKLM" Win64="no"
                         Key="SOFTWARE\HIMSA\Installationinfo\Noah\v4"
                         Value="InstallPath"
                         Result="exists"
                         Variable="InstallNoah4Module"/>

    <!-- Find older NOAH 4.0 in 64 bit reg -->
    <util:RegistrySearch Id="findnoah40x64"
                         After="findnoah40x86"
                         Condition="not InstallNoah4Module"
                         Root="HKLM" Win64="yes"
                         Key="SOFTWARE\HIMSA\Installationinfo\Noah\v4"
                         Value="InstallPath"
                         Result="exists"
                         Variable="InstallNoah4Module"/>