A more complete Inno setup script, which adds the ability to set INI files, is a common feature of an installation package.
- [Setup]
- ; Note: The value of AppID identifies the application individually.
- ; Do not use the same AppID value for the other setup programs.
- ; (Generate a new GUID, click Tools | Build the GUID in the IDE.) )
- appid={{a9861883-31c5-4324-bd9a-dc3271eeb675}
- ; Program Name
- Appname=issample
- ; version number
- Appvername=issample 1.0.0.0
- ; Publisher name
- Apppublisher=hkiss
- ; related connections
- Apppublisherurl=http://zwkufo.blog.163.com
- Appsupporturl=http://zwkufo.blog.163.com
- Appupdatesurl=http://zwkufo.blog.163.com
- ; default installation directory
- Defaultdirname={pf}\issample
- ; default start dish sole name
- Defaultgroupname=issample
- Open, Optional Install Start menu item
- ; Allownoicons=yes
- ; Installation protocol
- ; Licensefile=c:\example\ Original File \agreement.txt
- ; A text file to view before installation
- ; infobeforefile=c:\example\ Original File \setup_new.txt
- ; View text files after installation
- ; infoafterfile=c:\example\ Original File \setup_old.txt
- ; output folder
- Outputdir=c:\example\innosetup\out
- ; Output file name
- Outputbasefilename=setup
- ; Install icon
- Setupiconfile=c:\example\ Original File \title.ico
- installation requires a password.
- ; Password=123
- ; Encryption=yes
- ; Compression related
- Compression=lzma
- Solidcompression=yes
- ; Can let users ignore select language related
- Showlanguagedialog = yes
- ; Note Version information
- Versioninfocompany=http://www.hkiss.com
- Versioninfodescription=issample-enhanced version of Chinese
- versioninfoversion=1.0.0.0
- Versioninfocopyright=copyright (C) 2007-2008 Hkiss
- ; Make a choice language
- [Languages]
- Name: "CHS"; Messagesfile: "COMPILER:DEFAULT.ISL"; LicenseFile: "C:\Example\ original file \chs\agreement.txt"
- Name: "EN"; Messagesfile: "COMPILER:LANGUAGES\ENGLISH.ISL"; LicenseFile: "C:\Example\ original file \en\agreement.txt"
- ; user-defined tasks
- [Tasks]
- Name: "Desktopicon"; Description: "{Cm:createdesktopicon}"; Groupdescription: "{cm:additionalicons}"; Flags:unchecked
- Name: "Quicklaunchicon"; Description: "{Cm:createquicklaunchicon}"; Groupdescription: "{cm:additionalicons}"; Flags:unchecked
- Name: "Tasks_1"; Description: "User custom Task 1"; Flags:unchecked
- Name: "Tasks_2"; Description: "User custom Task 2"; Flags:unchecked
- ; custom tasks that appear when a component is selected
- Name: "Tasks_3"; Description: "User custom Task 3"; COMPONENTS:C1; Flags:unchecked
- ; file Installation
- [Files]
- Multi-language installation environment set common parameters languages to set
- Source: "C:\Example\ original file \enfile.txt"; DestDir: "{app}"; Languages:en; Flags:ignoreversion
- Source: "C:\Example\ original file \chsfile.txt"; DestDir: "{app}"; Languages:chs; Flags:ignoreversion
- ; user-defined task tasks
- Source: "C:\Example\ original file \tasks\tasks_1.txt"; DestDir: "{app}\tasks"; Flags:ignoreversion; Tasks:tasks_1
- Source: "C:\Example\ original file \tasks\tasks_2.txt"; DestDir: "{app}\tasks"; Flags:ignoreversion; Tasks:tasks_2
- Source: "C:\Example\ original file \tasks\tasks_components.txt"; DestDir: "{app}\tasks"; Flags:ignoreversion; Tasks:tasks_2
- ; user-defined component installation
- Source: "C:\Example\ original file \components\components_1.txt"; DestDir: "{app}\components"; Flags:ignoreversion; COMPONENTS:A1;
- Source: "C:\Example\ original file \components\components_2.txt"; DestDir: "{app}\components"; Flags:ignoreversion; COMPONENTS:A2;
- Source: "C:\Example\ original file \components\components_3.txt"; DestDir: "{app}\components"; Flags:ignoreversion; COMPONENTS:A3;
- Source: "C:\Example \ Original file \components\components_4.txt"; DestDir: "{app} \components"; Flags:ignoreversion; COMPONENTS:A1 A2 A3;
- User Register custom DLL file RegServer Register Noregerror do not display error message
- Source: "C:\Example\ original file \jmail.dll"; DestDir: "{app}"; Flags:ignoreversion regserver
- ; Add a Readme file
- Source: "C:\Example\ original file \issample.txt"; DestDir: "{app}"; Flags:ignoreversion
- Add a file to cache folder {TMP} Deleteafterinstall after installation is removed
- Source: "C:\Example\ original file \test.exe"; DestDir: "{tmp}"; Flags:ignoreversion Deleteafterinstall
- Source: "C:\Example\ original file \issample.chm"; DestDir: "{app}"; Flags:ignoreversion
- Source: "C:\Example\ original file \issample.exe"; DestDir: "{app}"; Flags:ignoreversion
- Source: "C:\Example\ original file \issample.dll"; DestDir: "{app}"; Flags:ignoreversion
- Source: "C:\Example\ original file \issample.ini"; DestDir: "{app}"; Flags:ignoreversion
- Source: "C:\Example\ original file \issample.rar"; DestDir: "{app}"; Flags:ignoreversion
- Source: "C:\Example\ original file \issample_sys.dll"; DestDir: "{win}\system32"; Flags:ignoreversion
- Source: "C:\Example\ original file \log\*"; DestDir: "{app}\log"; Flags:ignoreversion Recursesubdirs Createallsubdirs
- ; Note: Do not use "flags:ignoreversion" on any shared system files
- ; Setup Type Setup
- [Types]
- Name:full;D escription: "Fully Installed"; Flags:iscustom
- Name:compact;D escription: "Simple Installation";
- Name:custom; Description: "Custom Installation";
- ; component Installation
- [Components]
- NAME:C1; Description: "Custom Task 3"; Types:full
- NAME:A1; Description: "Install Components_1"; Types:full Compact Custom;
- NAME:A2; Description: "Install components_2"; Types:full Compact
- NAME:A3; Description: "Install Components_3"; Types:full
- ; Start menu, desktop shortcut
- [Icons]
- Name: "{group}\issample"; Filename: "{app}\issample.exe"
- Name: "{group}\{cm:programontheweb,issample}"; Filename: "Http://zwkufo.blog.163.com"
- Name: "{group}\{cm:uninstallprogram,issample}"; Filename: "{Uninstallexe}"
- Name: "{commondesktop}\issample"; Filename: "{App}\issample.exe"; Tasks:desktopicon
- Name: "{userappdata}\microsoft\internet explorer\quick launch\issample"; Filename: "{App}\issample.exe"; Tasks:quicklaunchicon
- ; Add a Help text block
- Name: {group}\issample 1.0.0.0 help document; Filename: {app}\issample.chm
- Used to execute programs commonly used with the run main program display readme file to delete temporary files after the program installation is complete before the Setup program displays the final dialog box
- [Run]
- Filename: "{App}\issample.exe"; Description: "{cm:launchprogram,issample}"; Flags:nowait Postinstall skipifsilent
- Filename: "{app}\issample.txt"; Description: "View Show Readme File"; Flags:postinstall skipifsilent shellexec
- ; Change the text of the message displayed in the program
- [Messages]
- Beveledlabel=hkiss Technology
- ; Uninstall dialog box description
- Confirmuninstall= do you really want to uninstall Issample from your computer?%n%n Press [Yes] to completely remove%1 and all its components;%n press [No] to leave the software on your computer.
- ; Define decompression Instructions
- ; statusextractfiles= unzip and copy the main program files and related library files ...
- ; Used to create, modify, or delete INI file health values in the user system
- [INI]
- Filename: "{App}\cfg.ini"; Section: "Startup Options"; Flags:uninsdeletesection
- Filename: "{App}\cfg.ini"; Section: "Startup Options"; Key: "Server IP"; String: "127.0.0.1"
- Filename: "{App}\cfg.ini"; Section: "Startup Options"; Key: "Server Port"; String: "8080"
- ; Used to create, modify, or delete registry keys in the user's system
- [Registry]
- ROOT:HKLM; Subkey: "Software\issample"; Valuetype:dword; Valuename:config; Valuedata:10; Flags:uninsdeletevalue
- ; in executing a script
- [Code]
- Global variables
- var Myprogchecked:boolean;
- Determine if the program exists
- Initial Chinese program events
- function Initializesetup (): boolean;
- var Isbl:boolean; declaring variables
- var isstr:string;
- Begin//Start
- ISBL: = true; Assigning values to variables
- ISSTR: = ' welcome ';
- If Regvalueexists (HKEY_LOCAL_MACHINE, ' software\issample ', ' config ') then
- Begin
- MsgBox (' has been installed, please first uninstall in the installation ', Mbconfirmation, MB_OK);
- ISBL: = false;
- End Else
- Begin
- MsgBox (' No value ', mbconfirmation, MB_OK);
- ISBL: = true;
- End
- The following is a troublesome conditional statement end ELSE note
- If MsgBox (Isstr, mbconfirmation, mb_okcancel) = IDOK Then
- Begin
- ISBL: = true;
- MsgBox (' performed ', Mbconfirmation, MB_OK);
- End Else
- Begin
- ISBL: = false;
- MsgBox (' performed ', Mbconfirmation, MB_OK);
- End
- Result: = ISBL;
- End End
- Procedure curstepchanged (Curstep:tsetupstep);
- var isstr:string;
- Begin
- If Curstep=ssinstall then//before actual installation is called
- Begin
- MsgBox (' curstepchanged: Call before actual installation ', mbconfirmation, mb_okcancel); Called after installation is complete
- End
- If Curstep=sspostinstall Then
- Begin
- ISSTR: = Expandconstant (' {tmp}\tmp.rar ');
- If FileExists (ISSTR) Then
- Begin
- MsgBox (' file exists ', mbconfirmation, MB_OK);
- End Else
- Begin
- MsgBox (' file does not exist ', mbconfirmation, MB_OK);
- End
- MsgBox (' curstepchanged: Call after actual installation ', mbconfirmation, mb_okcancel);
- End
- End
- Next Button button Event
- function Nextbuttonclick (Curpageid:integer): Boolean;
- var Resultcode:integer;
- var Issetup:boolean;
- Begin
- Issetup: = true;
- Case Curpageid of
- Wpselectdir:
- MsgBox (' Nextbuttonclick: ' #13 #13 ' you selected: ' + Wizarddirvalue + ' '. ', mbinformation, MB_OK); Wizarddirvalue Path
- Wpselectprogramgroup:
- MsgBox (' Nextbuttonclick: ' #13 #13 ' you selected: ' + Wizardgroupvalue + ' '. ', mbinformation, MB_OK); Start Vegetable sole Name
- Wpready:
- Begin
- If not regvalueexists (HKEY_LOCAL_MACHINE, ' software\test ', ' config ') THEN BEGIN
- If MsgBox (' program execution requires test.ext, install! ', mbconfirmation, mb_yesno) = Idyes THEN BEGIN
- Extracttemporaryfile (' Test.exe ');
- If not Exec (Expandconstant (' {tmp}\test.exe '), "', '", SW_SHOWNORMAL, ewwaituntilterminated, ResultCode) Then
- MsgBox (' Test.exe error: ' #13 #13 ' + syserrormessage (resultcode) + '. ', Mberror, MB_OK);
- End ELSE begin
- Issetup: = false;
- End;
- Bringtofrontandrestore ();
- End
- End
- End
- Result: = Issetup;
- End
A more complete Setup script for Inno setup (GO)