shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Set property to either of two values

I've searched the help text and the forums and haven't found an answer for this problem. If I've missed something obvious, feel free to hit me over the head with it! :D

I have created two searches that look for values in the registry, let's call them SEARCH1 and SEARCH2. SEARCH1 will always return a result; SEARCH2 may or may not.

I need to create a registry key that includes a parameter as one of the nodes in the key. I know how to do this in the Registry window using something like this:
ABC/[MY_VALUE]/Application/...

The challenge I have is the logic for setting MY_VALUE. If SEARCH2 returns a value, I want to set MY_VALUE to the result of SEARCH2; otherwise, I want to set MY_VALUE to the result of SEARCH1.

Is there a way to accomplish this in AI that I haven't found yet?

As a fallback, I think I can create two separate reg keys in the registry window using the User Guide article about 32-bit/64-bit reg entries (http://www.advancedinstaller.com/user-g ... istry.html). However, it seems much cleaner to be able to set a property to either of two values.

Thanks.
glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

Re: Set property to either of two values

Hello!
Some time ago, I had a similar problem.
I have solved it by using two "new custom actions" of type "Property set with formatted".

Action 1:

Code: Select all

Property Name : MY_VALUE
FormattedText : [SEARCH2]
Executing Condition: SEARCH2 <> ""
Action 2:

Code: Select all

Proerty Name: MY_VALUE
Formatted text : [SEARCH1]
Executing Condition: SEARCH2 = ""
Kind regards,
Christof Konstantinopoulos
shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: Set property to either of two values

Great idea!! Thank you!

After some experimentation, I ended up using a variation of your suggestion. Because I already have a launch condition that either SEARCH1 or SEARCH2 must exist, I created MY_VALUE as a property on the Installation Parameters page and gave it a value equivalent to the result of SEARCH1. That way I only need one custom action

Code: Select all

Property Name : MY_VALUE
FormattedText : [SEARCH2]
Executing Condition: SEARCH2 = "XYZ"
As a result my registry key name is the SEARCH1 value by default but takes the SEARCH2 value if it meets the test.

Thanks again,
Scott
max2u
Posts: 3
Joined: Mon Sep 07, 2009 8:42 am

Re: Set property to either of two values

Aloha,
well this didnt work for me in the default install directory, is there a way to excute the actions before checking for the install directory.

thanks.
shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: Set property to either of two values

It may depend on where you place the custom actions. I initially placed mine under Install in the InstallExecuteSequence. As I recall, they they didn't work there (it was apparently too late in the process). So I added the WelcomeDlg to the InstallUISequence, placed the custom action under that dialog, and everything worked exactly as I hoped.

Scott

Return to “Common Problems”