inno-setupinno-setup-v6

Skip pages when updating existing installation


How do I have InnoSetup skip the license agreement page as well as the page asking if the user wants to create a desktop shortcut when the there is already an existing installation? I do want these to show on the initial installation.

When the app has already been installed, I would like minimal button presses needed in order to install the update. No need to have the user accept the license agreement again, or specify if desktop shortcut needs to be added. I push out regular updates and want it to be as un-obtrusive as possible.


Solution

  • Here is what I got working - this skips the license page as well as the tasks page:

    [Code]
    function IsUpgrade: Boolean;
    var
        Value: string;
        UninstallKey: string;
    begin
        UninstallKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' +
            ExpandConstant('{#SetupSetting("AppId")}') + '_is1';
        Result := (RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Value) or
            RegQueryStringValue(HKCU, UninstallKey, 'UninstallString', Value)) and (Value <> '');
    end;
    
    function ShouldSkipPage(PageID: Integer): Boolean;
    begin
    if IsUpgrade then
      begin
      if PageID = wpLicense then
        Result := true
      end;
      begin
      if PageID = wpSelectTasks then
        Result := true
      end;
    end;