Stein Inge
10-01-2008, 01:24 PM
This question might sounds a bit stupid and I feel that I have painted myself a bit into a corner. The situation is that my current version is called 2007.x.xxx while my new version is 8.0.xxx. So it’s a bit difficult to tell TrueUpdate that v8 is actually newer then v2007. If you have any suggestions to how I can fix this, I would be very, very happy. This is what I have tried, but it did not work.
------------------------------------------
-- Identify the Installed Version
------------------------------------------
-- Read the installed version information from the registry
g_InstalledVersion = Registry.GetValue(g_RegMainKey, g_RegSubKey, g_RegValueName);
error = Application.GetLastError();
if(error ~= 0) then
SessionVar.Set("%ErrorMessage%", TrueUpdate.GetLocalizedString("ERR_DETECT_VERSION_FAILED").."\r\n".._tblErrorMessages[error]);
Screen.Show("Update Failed");
Application.ExitScript();
end
-- If the installed version is older than the target version, we need to perform the update
local nSpecialVerTest = String.ToNumber( String.GetWordNum( g_InstalledVersion, 1, ".") ) ;
if nSpecialVerTest <= 2007 and nSpecialVerTest > 1990 then
gUpdateRequired = true;
elseif(String.CompareFileVersions(g_InstalledVersi on, g_TargetVersion) == -1) then
g_UpdateRequired = true;
else
g_UpdateRequired = false;
end
-- Exit if an update isn't required
if not g_UpdateRequired then
Screen.Show("Update Not Required");
Application.ExitScript();
end
best regards
Stein Inge Haaland
------------------------------------------
-- Identify the Installed Version
------------------------------------------
-- Read the installed version information from the registry
g_InstalledVersion = Registry.GetValue(g_RegMainKey, g_RegSubKey, g_RegValueName);
error = Application.GetLastError();
if(error ~= 0) then
SessionVar.Set("%ErrorMessage%", TrueUpdate.GetLocalizedString("ERR_DETECT_VERSION_FAILED").."\r\n".._tblErrorMessages[error]);
Screen.Show("Update Failed");
Application.ExitScript();
end
-- If the installed version is older than the target version, we need to perform the update
local nSpecialVerTest = String.ToNumber( String.GetWordNum( g_InstalledVersion, 1, ".") ) ;
if nSpecialVerTest <= 2007 and nSpecialVerTest > 1990 then
gUpdateRequired = true;
elseif(String.CompareFileVersions(g_InstalledVersi on, g_TargetVersion) == -1) then
g_UpdateRequired = true;
else
g_UpdateRequired = false;
end
-- Exit if an update isn't required
if not g_UpdateRequired then
Screen.Show("Update Not Required");
Application.ExitScript();
end
best regards
Stein Inge Haaland