Uninstall former version

  • Print

If you wish to uninstall the existing version of your product automatically when your customer runs the installer made with Setup Factory of a newer (or the same) version, you can use this screen and script:

How to use

  • Download the installer below and select the desired package for installation. The files will be deployed in:

    For Windows XP:
    C:\Documents and Settings\All Users\Application Data\IndigoRose\Setup Factory\9.0\Screens\

    For Windows Vista or Windows 7:
    C:\ProgramData\IndigoRose\Setup Factory\9.0\Screens\

  • Include the custom screen in your installer, offering the option to uninstall the former version of your product before deploying the new files. The screen is named "Former install found":
  • Finally, you should then include the following code in the On Pre Install script:
 
-- check if uninstall was requested
if (bRequestedUninstall) then
    if (File.DoesExist(sMyUninstallInfo[1])) then
        Application.Minimize();
        -- perform a silent uninstall of the application
        -- add quotes to configuration file argument (it may contain spaces)
        -- and add /S at the end
        res = File.Run(sMyUninstallInfo[1], '"'..sMyUninstallInfo[2]..'" /S', "", 
            SW_SHOWNORMAL, true);
        error = Application.GetLastError();
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        else
            SetupData.WriteToLogFile("Info\tUninstallation performed successfully\r\n", true);
            -- wait for the uninstaller to be deleted in the background
            -- before deploying the new files (it can take a second or two)
            StatusDlg.Show();
            StatusDlg.SetTitle("Deleting old version");
            StatusDlg.SetMessage("Please wait...");
            StatusDlg.ShowProgressMeter(false);
            while File.DoesExist(sMyUninstallInfo[1]) do
                SetupData.WriteToLogFile("Waiting one second...\r\n", true);
                Application.Sleep(1000);
            end
            StatusDlg.Hide();
        end
        Application.Restore();
    else
        SetupData.WriteToLogFile("Error\tUninstaller could not be found!\r\n", true);
    end
end
 

Download

Custom Screens for Setup Factory 9

Click to downloadFile size: 1.92 MB
Current version: 1.0.2.0
Updated: February 2013

Example project

Click to downloadFile size: 18 KB
Updated: October 2010

Make sure that you enabled the silent uninstall in your project (see Uninstall > Settings > Options > Allow silent uninstall), or your customer will see the uninstallation wizard.

Don't have Setup Factory?

If you want to purchase a license for Setup Factory 9, now is a good time! For a limited period, you can get 10% off the list price simply by clicking the banner below:

 

Comments 

 
# đặng ngọc nguyễn 2010-11-24 03:52
tôi ở việt nam ( iam from viet nam
i like your web ...
very good !
good luck !
 
 
# arno512 2012-03-19 10:30
thank you !
very good...
 

Add a comment (For questions, please use the contact form!)

Security code
Refresh

Our Plugins & Examples Feed

  • HTTP Actions plugin updated to 2.1.0.0

    Two new actions were added to the HTTP plugin:

    • HTTP.ResumeDownload()
    • HTTP.ResumeDownloadSecure()

    With these new "Resume" actions, you can...

  • Unicode Actions plugin updated to 2.0.3.0

    A new version of the Unicode actions plugin was released.

    Changes were made to the code...

Subscribe now!

Customer Login



mindquake.com.br Webutation

Click to check at AVG ThreadLabs

All installers digitally signed

Click to visit McAfee SiteAdvisor

Mindquake.com.br is gold certified

PageRank Checker