VisualPatch.GetTargetVersion

string VisualPatch.GetTargetVersion ( 

 )

Example 1

-- Define a global variable that will indicate the name
-- of the installed version on the user's system. A nil value
-- indicates that an installed version has not been found.
g_InstalledVersion = nil;

-- Location method: Current folder
-- Check whether the software is installed in the folder
-- that the patch was run from.
if not g_InstalledVersion then
    g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", _SourceFolder);
    if g_InstalledVersion then
        SessionVar.Set("%AppFolder%", _SourceFolder);
    end
end



-- Set session variables that will be used in the log file
-- and in the user interface.
if g_InstalledVersion then
    SessionVar.Set("%InstalledVersion%", g_InstalledVersion);
    SessionVar.Set("%TargetVersion%", VisualPatch.GetTargetVersion());
end

Determines if the folder where the patch is running from contains a valid version of the application. If it does, session variables are created to hold the installed version and current version (or target version) strings.

Example 2

-- Decide which "Before Patching" screen to show.
if g_InstalledVersion then
    if g_InstalledVersion == VisualPatch.GetTargetVersion() then
        -- The target version was found
        Screen.SetStartScreen("Software is Current");
    else
        -- An out-of-date version was found
        Screen.SetStartScreen("Ready to Patch");
    end
else
    -- No version was found
    Screen.SetStartScreen("Cannot Locate Software");
end

Determines if the user already has the current version of the software on their system or whether it needs to be patched. This information is gathered in order to show the appropriate first screen to the user.

See also:  Related Actions