I'm having an issue with an If statement when comparing version numbers. I have a very simple script for testing.
The version in my registry and the version to compare against is the same. In the If statement, I should be getting the MessageBox "No need to upgrade", but I am not.
Define Component: Native Setup
Set Variable VERSION_CHECK to 22.0.0.192
Read Registry Key HKLM\SOFTWARE\Macromedia\FlashPlayerActiveX\Version into VERSION_REGISTRY
MessageBox: , VERSION_CHECK: $VERSION_CHECK$$NEWLINE$$NEWLINE$VERSION_REGISTRY: $VERSION_REGISTRY$
if Variable VERSION_REGISTRY Greater Than (Version) $VERSION_CHECK$
MessageBox: , No Need to upgrade
else
MessageBox: , Need to upgrade
end
Terminate Installation
Set Variable VERSION_CHECK to 22.0.0.192
Set Variable GREATER_VALUE to 22.0.0.198
Set Variable LOWER_VALUE to 22.0.0.101
MessageBox: , VERSION_CHECK: $VERSION_CHECK$$NEWLINE$$NEWLINE$GREATER_VALUE: $GREATER_VALUE$$NEWLINE$$NEWLINE$LOWER_VALUE: $LOWER_VALUE$
if Variable GREATER_VALUE Greater Than (Version) $VERSION_CHECK$
MessageBox: , It's Greater!
else
MessageBox: , Need to upgrade
end
if Variable LOWER_VALUE Greater Than (Version) $VERSION_CHECK$
MessageBox: , It's Greater!
else
MessageBox: , It's lower!
end
The difference is that I am reading the registry for a String value and storing in $VERSION_REGISTRY$ variable.
If you by chance have Adobe Flash Player ActiveX installed, can you also try reading the same registry key or another registry key that has a String value?
Is there something I need to do after reading a registry key that I am not doing?
The $VERSION_CHECK$ Variable and the $VERSION_REGISTRY$ value is the same for me.
I modified yours where I made the $VERSION_CHECK$ and $GREATER_VALUE$ the same and had the same issue.
In this situation, the value might be less, equal, or greater. How should I best approach the script? Greater or equal do no thing. If is less than, upgrade?
...maybe I am missing something, but if you only need to do "something" when a A value is less than B value, just evaluate this condition. If this is true then do something.