PDA

View Full Version : Checking Local Version to overwrite file



steve@trimpos.net
09-19-2017, 09:05 AM
I am using automatic updates (wupdate) and would like to install a new file only if the customer is on a version prior to 23.01.27 (the file will contain critical data if the customer is on a version after that). I have done the following:

! at top of script where all variables are registered:
Set Variable %_SB_PARAM5% to FUNCTION:Detect Previous Version ("{7D3B3610-30D4-11DD-66BB-048967B36443}")

! Under Install Files:

If %_SB_PARAM5% Less Than or Equal "23.01.26" Then
Install File(s) "C:\32bitpabp\Flashver23\data\UsPayTab.adt" to "%_SB_INSTALLDIR%\flash\data\UsPayTab.adt" [Feature:Always Install]
Install File(s) "C:\32bitpabp\Flashver23\data\paytable.adi" to "%_SB_INSTALLDIR%\flash\data\paytable.adi" [Feature:Always Install]
Install File(s) "C:\32bitpabp\Flashver23\data\paytable.adt" to "%_SB_INSTALLDIR%\flash\data\paytable.adt" [Feature:Always Install]
End

Even if I set the Local_Version flag in the registry to 23.01.27 the file is still overwritten. Any one know what I am missing?

linder
09-20-2017, 03:42 AM
Hi Steve,

The "Detect Previous Version" function returns the path of a previously distributed version of your product.

If the function succeeds, %_SB_RETURNEX% contains the installed version number (if available).

I have attached a screenshot with a code snippet on how to handle it.

Does this help?

Friedrich

steve@trimpos.net
09-20-2017, 11:04 AM
Where does the returned version come from?
I have:
Set Variable %DEV_VER% to FUNCTION:Detect Previous Version ("{7D3B3610-30D4-11DD-66BB-048967B36443}")
Set Variable %INSTALLED_VERSION% to "%_SB_RETURNEX%"

If %INSTALLED_VERSION% Less Than "23.01.26" Then
Install File(s) "C:\32bitpabp\Flashver23\data\UsPayTab.adt" to "%_SB_INSTALLDIR%\flash\data\UsPayTab.adt" [Feature:Always Install]
Install File(s) "C:\32bitpabp\Flashver23\data\paytable.adi" to "%_SB_INSTALLDIR%\flash\data\paytable.adi" [Feature:Always Install]
Install File(s) "C:\32bitpabp\Flashver23\data\paytable.adt" to "%_SB_INSTALLDIR%\flash\data\paytable.adt" [Feature:Always Install]
End

I have attached an image with what is set in registry:
4630

steve@trimpos.net
09-20-2017, 01:34 PM
Ok after more testing, I am still having problems. To test I have the installer sending back what is set in the flag and displaying a message box. If I have the following (I know the flag is set to 23.01.25 as I have it showing in the heading):

If %INSTALLED_VERSION% Less Than "23.01.26" Then
Display Message Box ("Flag %INSTALLED_VERSION% is less than 23.01.26", "") [Noisy]
End
If %INSTALLED_VERSION% Equals "23.01.26" Then
Display Message Box ("Flag %INSTALLED_VERSION% equal to 23.01.26", "") [Noisy]
End
If %INSTALLED_VERSION% Greater Than "23.01.26" Then
Display Message Box ("Flag %INSTALLED_VERSION% more than 23.01.26", "") [Noisy]
End

I get no message boxes with the above, so I tried:

If %INSTALLED_VERSION% Less Than or Equal "23.01.26" Then
Display Message Box ("Flag %INSTALLED_VERSION% is less than 23.01.26", "") [Noisy]
End
If %INSTALLED_VERSION% Equals "23.01.26" Then
Display Message Box ("Flag %INSTALLED_VERSION% equal to 23.01.26", "") [Noisy]
End
If %INSTALLED_VERSION% Greater Than or Equal "23.01.26" Then
Display Message Box ("Flag %INSTALLED_VERSION% more than 23.01.26", "") [Noisy]
End

and I get both the attached message boxes.46314632.

Any ideas, I am baffled.

linder
09-21-2017, 02:59 AM
Steve,

please see my previous screenshot. You are using the wrong Condition. Please use "Version Less Than..." !!!

Does this help?

Friedrich

linder
09-21-2017, 03:02 AM
Steve,

The "Detect Previous Version" function uses the Product GUID of previously distributed versions to determine if the application is installed on the client. It only works if the previous installation created a Product GUID (code) in the following section of the Windows registry:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr entVersion\Uninstall

SetupBuilder automatically creates this item if the Add/Remove Programs Support option is enabled in the "General Information" Visualizer.

The above installation information is a Windows development guidelines requirement.

Friedrich

steve@trimpos.net
09-22-2017, 10:10 AM
You are correct, I had the wrong flag set. Works great now, Thank you

linder
09-22-2017, 12:57 PM
Perfect! Thanks for the update, Steve.

Friedrich