psf
Posts: 43
Joined: Wed Jun 04, 2014 11:00 am

launch condition to check if a build number is bigger than a certain value

I am using AI 11.4.1.
I wish to check that the current installed build version of an existing product is suitably high to be compatible with our product.
I have created a launch condition which looks in the registry and retrieves a DWORD value as a 'raw value, in this case 1104, and store it in a property , INSTALLED_BUILD_NUMBER say.
I wish to compare this value against 990.
So I have a custom launch condition: INSTALLED_BUILD_NUMBER > 990
I was expecting this condition to be true, and the install to proceed.
However, the install thinks the condition is false. The installer displays the description text for that custom launch condition,
that text contains [INSTALLED_BUILD_NUMBER] and this is displayed as #1104 in the message box.
Could you please tell me what the appropriate syntax is that I need ?
I have tried INSTALLED_BUILD_NUMBER > "#990", which also fails, I suspect it's doing a string comparison in that case - is there a way of converting the string to a numeric value when the comparison is actually done?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: launch condition to check if a build number is bigger than a certain value

Hello,

Can you please make sure the search you have configured succeed during installation? Please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
psf
Posts: 43
Joined: Wed Jun 04, 2014 11:00 am

Re: launch condition to check if a build number is bigger than a certain value

the files are attached.
if you add a dword value to HKLM\software\boldon james\test key, in the test entry, with value 5, the setup test passes, but if you have value 10, it fails.
Attachments
testinstall.log
(80.73 KiB) Downloaded 280 times
setup.aip
(14.28 KiB) Downloaded 405 times
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: launch condition to check if a build number is bigger than a certain value

Hello,

I've tested and replicated the behavior. This happens because of the type of your registry value (i.e. dword). For dword entries, the searches property will contain the registry entry's value preceded by the "#" character (for example "#5", "#10"). In this case when the launch condition is evaluated the comparison will be done between strings:

Code: Select all

"#5" >= "#4" (TRUE)
"#10" >= "#4" (FALSE)
This is the Windows Installer default behavior. To achieve what you want you can use a custom action which will parse the search result (TEST_VAL property) and remove its first character (i.e. #). For example you can use an "Execute inline script code" custom action with the following code:

Code: Select all

mySearch = Session.Property("TEST_VAL")
mySearch = Mid(mySearch,2)
Session.Property("TEST_VAL") = mySearch
The custom action should be added as a custom action with sequence just after "Searches" action group.

Also, in the "Condition" field of your custom launch condition you should use a condition like this:

Code: Select all

TEST_VAL >= 4
I've edited and attached your project which implements the above changes.
setup.aip
(14.59 KiB) Downloaded 396 times
Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
psf
Posts: 43
Joined: Wed Jun 04, 2014 11:00 am

Re: launch condition to check if a build number is bigger than a certain value

Yes , your code has fixed the problem. Thanks.
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: launch condition to check if a build number is bigger than a certain value

You're welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
psf
Posts: 43
Joined: Wed Jun 04, 2014 11:00 am

Re: launch condition to check if a build number is bigger than a certain value

Could you just tell me how you created your ExecuteInlineScript custom action so that it appears in both the Wizard Dialogs Stage list and also the Install Execution Stage list ? when I try to add this custom action to my existing project, it appears under one or the other, but not both. thanks
psf
Posts: 43
Joined: Wed Jun 04, 2014 11:00 am

Re: launch condition to check if a build number is bigger than a certain value

The trick is to press the shift key down, then drag the custom action from the dialog stage to the execution stage or vice-versa, to get a copy in both areas.
thanks to Dan for that tip.
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: launch condition to check if a build number is bigger than a certain value

Hello,

Indeed, In order to have the same custom action in both Wizard Dialogs stage and Install Execution stage you need to share the custom action.

In order to share a custom action, provided one it is located in the Wizards Dialogs Stage and the other in the Install Execution Stage, simply drag the custom action from one stage to the other, while pressing the Shift key.

From the custom actions properties you can use the Advanced execution scenarios link for corner case execution options.

If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”