A more complete Setup script for Inno setup (GO)

Source: Internet
Author: User
Tags compact

A more complete Inno setup script, which adds the ability to set INI files, is a common feature of an installation package.

 
  1. [Setup]
  2. ; Note: The value of AppID identifies the application individually.
  3. ; Do not use the same AppID value for the other setup programs.
  4. ; (Generate a new GUID, click Tools | Build the GUID in the IDE.) )
  5. appid={{a9861883-31c5-4324-bd9a-dc3271eeb675}
  6. ; Program Name
  7. Appname=issample
  8. ; version number
  9. Appvername=issample 1.0.0.0
  10. ; Publisher name
  11. Apppublisher=hkiss
  12. ; related connections
  13. Apppublisherurl=http://zwkufo.blog.163.com
  14. Appsupporturl=http://zwkufo.blog.163.com
  15. Appupdatesurl=http://zwkufo.blog.163.com
  16. ; default installation directory
  17. Defaultdirname={pf}\issample
  18. ; default start dish sole name
  19. Defaultgroupname=issample
  20. Open, Optional Install Start menu item
  21. ; Allownoicons=yes
  22. ; Installation protocol
  23. ; Licensefile=c:\example\ Original File \agreement.txt
  24. ; A text file to view before installation
  25. ; infobeforefile=c:\example\ Original File \setup_new.txt
  26. ; View text files after installation
  27. ; infoafterfile=c:\example\ Original File \setup_old.txt
  28. ; output folder
  29. Outputdir=c:\example\innosetup\out
  30. ; Output file name
  31. Outputbasefilename=setup
  32. ; Install icon
  33. Setupiconfile=c:\example\ Original File \title.ico
  34. installation requires a password.
  35. ; Password=123
  36. ; Encryption=yes
  37. ; Compression related
  38. Compression=lzma
  39. Solidcompression=yes
  40. ; Can let users ignore select language related
  41. Showlanguagedialog = yes
  42. ; Note Version information
  43. Versioninfocompany=http://www.hkiss.com
  44. Versioninfodescription=issample-enhanced version of Chinese
  45. versioninfoversion=1.0.0.0
  46. Versioninfocopyright=copyright (C) 2007-2008 Hkiss
  47. ; Make a choice language
  48. [Languages]
  49. Name: "CHS"; Messagesfile: "COMPILER:DEFAULT.ISL"; LicenseFile: "C:\Example\ original file \chs\agreement.txt"
  50. Name: "EN"; Messagesfile: "COMPILER:LANGUAGES\ENGLISH.ISL"; LicenseFile: "C:\Example\ original file \en\agreement.txt"
  51. ; user-defined tasks
  52. [Tasks]
  53. Name: "Desktopicon"; Description: "{Cm:createdesktopicon}"; Groupdescription: "{cm:additionalicons}"; Flags:unchecked
  54. Name: "Quicklaunchicon"; Description: "{Cm:createquicklaunchicon}"; Groupdescription: "{cm:additionalicons}"; Flags:unchecked
  55. Name: "Tasks_1"; Description: "User custom Task 1"; Flags:unchecked
  56. Name: "Tasks_2"; Description: "User custom Task 2"; Flags:unchecked
  57. ; custom tasks that appear when a component is selected
  58. Name: "Tasks_3"; Description: "User custom Task 3"; COMPONENTS:C1; Flags:unchecked
  59. ; file Installation
  60. [Files]
  61. Multi-language installation environment set common parameters languages to set
  62. Source: "C:\Example\ original file \enfile.txt"; DestDir: "{app}"; Languages:en; Flags:ignoreversion
  63. Source: "C:\Example\ original file \chsfile.txt"; DestDir: "{app}"; Languages:chs; Flags:ignoreversion
  64. ; user-defined task tasks
  65. Source: "C:\Example\ original file \tasks\tasks_1.txt"; DestDir: "{app}\tasks"; Flags:ignoreversion; Tasks:tasks_1
  66. Source: "C:\Example\ original file \tasks\tasks_2.txt"; DestDir: "{app}\tasks"; Flags:ignoreversion; Tasks:tasks_2
  67. Source: "C:\Example\ original file \tasks\tasks_components.txt"; DestDir: "{app}\tasks"; Flags:ignoreversion; Tasks:tasks_2
  68. ; user-defined component installation
  69. Source: "C:\Example\ original file \components\components_1.txt"; DestDir: "{app}\components"; Flags:ignoreversion; COMPONENTS:A1;
  70. Source: "C:\Example\ original file \components\components_2.txt"; DestDir: "{app}\components"; Flags:ignoreversion; COMPONENTS:A2;
  71. Source: "C:\Example\ original file \components\components_3.txt"; DestDir: "{app}\components"; Flags:ignoreversion; COMPONENTS:A3;
  72. Source: "C:\Example \ Original file \components\components_4.txt"; DestDir: "{app} \components"; Flags:ignoreversion; COMPONENTS:A1 A2 A3;
  73. User Register custom DLL file RegServer Register Noregerror do not display error message
  74. Source: "C:\Example\ original file \jmail.dll"; DestDir: "{app}"; Flags:ignoreversion regserver
  75. ; Add a Readme file
  76. Source: "C:\Example\ original file \issample.txt"; DestDir: "{app}"; Flags:ignoreversion
  77. Add a file to cache folder {TMP} Deleteafterinstall after installation is removed
  78. Source: "C:\Example\ original file \test.exe"; DestDir: "{tmp}"; Flags:ignoreversion Deleteafterinstall
  79. Source: "C:\Example\ original file \issample.chm"; DestDir: "{app}"; Flags:ignoreversion
  80. Source: "C:\Example\ original file \issample.exe"; DestDir: "{app}"; Flags:ignoreversion
  81. Source: "C:\Example\ original file \issample.dll"; DestDir: "{app}"; Flags:ignoreversion
  82. Source: "C:\Example\ original file \issample.ini"; DestDir: "{app}"; Flags:ignoreversion
  83. Source: "C:\Example\ original file \issample.rar"; DestDir: "{app}"; Flags:ignoreversion
  84. Source: "C:\Example\ original file \issample_sys.dll"; DestDir: "{win}\system32"; Flags:ignoreversion
  85. Source: "C:\Example\ original file \log\*"; DestDir: "{app}\log"; Flags:ignoreversion Recursesubdirs Createallsubdirs
  86. ; Note: Do not use "flags:ignoreversion" on any shared system files
  87. ; Setup Type Setup
  88. [Types]
  89. Name:full;D escription: "Fully Installed"; Flags:iscustom
  90. Name:compact;D escription: "Simple Installation";
  91. Name:custom; Description: "Custom Installation";
  92. ; component Installation
  93. [Components]
  94. NAME:C1; Description: "Custom Task 3"; Types:full
  95. NAME:A1; Description: "Install Components_1"; Types:full Compact Custom;
  96. NAME:A2; Description: "Install components_2"; Types:full Compact
  97. NAME:A3; Description: "Install Components_3"; Types:full
  98. ; Start menu, desktop shortcut
  99. [Icons]
  100. Name: "{group}\issample"; Filename: "{app}\issample.exe"
  101. Name: "{group}\{cm:programontheweb,issample}"; Filename: "Http://zwkufo.blog.163.com"
  102. Name: "{group}\{cm:uninstallprogram,issample}"; Filename: "{Uninstallexe}"
  103. Name: "{commondesktop}\issample"; Filename: "{App}\issample.exe"; Tasks:desktopicon
  104. Name: "{userappdata}\microsoft\internet explorer\quick launch\issample"; Filename: "{App}\issample.exe"; Tasks:quicklaunchicon
  105. ; Add a Help text block
  106. Name: {group}\issample 1.0.0.0 help document; Filename: {app}\issample.chm
  107. 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
  108. [Run]
  109. Filename: "{App}\issample.exe"; Description: "{cm:launchprogram,issample}"; Flags:nowait Postinstall skipifsilent
  110. Filename: "{app}\issample.txt"; Description: "View Show Readme File"; Flags:postinstall skipifsilent shellexec
  111. ; Change the text of the message displayed in the program
  112. [Messages]
  113. Beveledlabel=hkiss Technology
  114. ; Uninstall dialog box description
  115. 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.
  116. ; Define decompression Instructions
  117. ; statusextractfiles= unzip and copy the main program files and related library files ...
  118. ; Used to create, modify, or delete INI file health values in the user system
  119. [INI]
  120. Filename: "{App}\cfg.ini"; Section: "Startup Options"; Flags:uninsdeletesection
  121. Filename: "{App}\cfg.ini"; Section: "Startup Options"; Key: "Server IP"; String: "127.0.0.1"
  122. Filename: "{App}\cfg.ini"; Section: "Startup Options"; Key: "Server Port"; String: "8080"
  123. ; Used to create, modify, or delete registry keys in the user's system
  124. [Registry]
  125. ROOT:HKLM; Subkey: "Software\issample"; Valuetype:dword; Valuename:config; Valuedata:10; Flags:uninsdeletevalue
  126. ; in executing a script
  127. [Code]
  128. Global variables
  129. var Myprogchecked:boolean;
  130. Determine if the program exists
  131. Initial Chinese program events
  132. function Initializesetup (): boolean;
  133. var Isbl:boolean; declaring variables
  134. var isstr:string;
  135. Begin//Start
  136. ISBL: = true; Assigning values to variables
  137. ISSTR: = ' welcome ';
  138. If Regvalueexists (HKEY_LOCAL_MACHINE, ' software\issample ', ' config ') then
  139. Begin
  140. MsgBox (' has been installed, please first uninstall in the installation ', Mbconfirmation, MB_OK);
  141. ISBL: = false;
  142. End Else
  143. Begin
  144. MsgBox (' No value ', mbconfirmation, MB_OK);
  145. ISBL: = true;
  146. End
  147. The following is a troublesome conditional statement end ELSE note
  148. If MsgBox (Isstr, mbconfirmation, mb_okcancel) = IDOK Then
  149. Begin
  150. ISBL: = true;
  151. MsgBox (' performed ', Mbconfirmation, MB_OK);
  152. End Else
  153. Begin
  154. ISBL: = false;
  155. MsgBox (' performed ', Mbconfirmation, MB_OK);
  156. End
  157. Result: = ISBL;
  158. End End
  159. Procedure curstepchanged (Curstep:tsetupstep);
  160. var isstr:string;
  161. Begin
  162. If Curstep=ssinstall then//before actual installation is called
  163. Begin
  164. MsgBox (' curstepchanged: Call before actual installation ', mbconfirmation, mb_okcancel); Called after installation is complete
  165. End
  166. If Curstep=sspostinstall Then
  167. Begin
  168. ISSTR: = Expandconstant (' {tmp}\tmp.rar ');
  169. If FileExists (ISSTR) Then
  170. Begin
  171. MsgBox (' file exists ', mbconfirmation, MB_OK);
  172. End Else
  173. Begin
  174. MsgBox (' file does not exist ', mbconfirmation, MB_OK);
  175. End
  176. MsgBox (' curstepchanged: Call after actual installation ', mbconfirmation, mb_okcancel);
  177. End
  178. End
  179. Next Button button Event
  180. function Nextbuttonclick (Curpageid:integer): Boolean;
  181. var Resultcode:integer;
  182. var Issetup:boolean;
  183. Begin
  184. Issetup: = true;
  185. Case Curpageid of
  186. Wpselectdir:
  187. MsgBox (' Nextbuttonclick: ' #13 #13 ' you selected: ' + Wizarddirvalue + ' '. ', mbinformation, MB_OK); Wizarddirvalue Path
  188. Wpselectprogramgroup:
  189. MsgBox (' Nextbuttonclick: ' #13 #13 ' you selected: ' + Wizardgroupvalue + ' '. ', mbinformation, MB_OK); Start Vegetable sole Name
  190. Wpready:
  191. Begin
  192. If not regvalueexists (HKEY_LOCAL_MACHINE, ' software\test ', ' config ') THEN BEGIN
  193. If MsgBox (' program execution requires test.ext, install! ', mbconfirmation, mb_yesno) = Idyes THEN BEGIN
  194. Extracttemporaryfile (' Test.exe ');
  195. If not Exec (Expandconstant (' {tmp}\test.exe '), "', '", SW_SHOWNORMAL, ewwaituntilterminated, ResultCode) Then
  196. MsgBox (' Test.exe error: ' #13 #13 ' + syserrormessage (resultcode) + '. ', Mberror, MB_OK);
  197. End ELSE begin
  198. Issetup: = false;
  199. End;
  200. Bringtofrontandrestore ();
  201. End
  202. End
  203. End
  204. Result: = Issetup;
  205. End

A more complete Setup script for Inno setup (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.