简体   繁体   中英

I want to create setup file with Inno Setup

I need help with Inno Setup. First of all I want to sorry about my english. I hope you understand me.

I have this script:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My software - BETA"
#define MyAppVersion "1.5"
#define MyAppExeName "My software.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{009E8058-565E-43F7-BEAD-34E283BCA6F4}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=D:\My software\EULA.rtf
OutputBaseFilename=My software - Setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "D:\My software\My software.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\My software\settings.txt"; DestDir: "{userappdata}\My software"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

The setup works but I want to add several options to the setup:

1) If the software is already installed then I want that will be an option that give the usere the ability to choose whether to overwrite the previous settings.. something like checkbox: "Don't overwrite the previous settings" and in by default the setup will not overwrite the previous settings.

2) In the uninstaller I want the option: "Remove also the settings" (something like that) and by default this option is unchecked

3) I want that the option "Create a desktop icon" will always be checked by default. I noticed that this option is checked by default only if the icon is already created before.

Thanks for helpers! Gil.

Answers for your question:

1-If you are installing a application which is already install it should give user uninstalling option.To keep Previous setting you can use Flags: onlyifdoesntexist for [Files] , or

Flags: createvalueifdoesntexist for [Registry] .

2-Put the following code in [Code] section,it should give user to removeing setting option.

[Code]
procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
  mres : integer;
begin
  case CurUninstallStep of
    usPostUninstall:
      begin
        mres := MsgBox('Do you want to Remove Settings?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
        if mres = IDYES then
          DelTree(ExpandConstant('{userdocs}\Myapp'), True, True, True);
      end;
  end;
end;

3-If you want the icon task Will be checked then remove the Flags: unchecked part from [Task] section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM