View Single Post
  #3  
Old 06-03-2017, 07:43
Gupta Gupta is offline
Banned
 
Join Date: Aug 2016
Location: https://t.me/pump_upp
Posts: 399
Thanks: 139
Thanked 715 Times in 231 Posts
Gupta is on a distinguished road
Send a message via ICQ to Gupta Send a message via AIM to Gupta Send a message via Yahoo to Gupta
How to add unlimited Redists from an ini?

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

#define public RedistsINI ".\\Redists.ini"

[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[Run]
#ifnexist RedistsINI
  #error Ini for redists reading can't be find
#endif
#define public Section
#define public i
#define public Counter
#expr Counter =  0
#define public RedistFileName
#define public RedistWorkingDir
#define public RedistParameters
#define public RedistFlags
#define public RedistCheck
#sub AddRedist
  #expr Counter = Counter + 1
  #expr Section = StringChange("RedistCounter", "Counter", str(Counter) )
  #expr RedistFileName = ReadIni(SourcePath + RedistsINI , Section , "FileName")
  #expr RedistWorkingDir = Readini(SourcePath + RedistsINI , Section , "Workingdir","{src}")
  #expr RedistParameters = Readini(SourcePath + RedistsINI , Section , "Parameters","")
  #expr RedistFlags = Readini(SourcePath + RedistsINI , Section, "Flags","waituntilterminated skipifdoesntexist")
  #expr RedistCheck = Readini(SourcePath + RedistsINI , Section , "Checks","")
  Filename: "{#RedistFileName}"; WorkingDir: "{#RedistWorkingDir}" ; Parameters: {#RedistParameters}; Flags: {#RedistFlags}; Check: {#RedistCheck};
#endsub
#for { i = 1 ; ReadIni( SourcePath + RedistsINI, StringChange( "RedistCounter", "Counter", str(i)) , "FileName" , "" ) != "" ; i++ } AddRedist
Ini Structure should be

Code:
[Redist1]
FileName={src}\redist\DirectX\DXSETUP.exe
Workingdir={src}
Parameters=
Flags=waituntilterminated 
;Checks=IsWin64 and Installredist and CheckError

[Redist2]
FileName={src}\redist\vcredist\vcredist_x86.exe
Workingdir={src}
Parameters=/Q
Flags=waituntilterminated 
;Checks=not IsWin64 and Installredist and CheckError

[Redist3]
FileName={src}\redist\vcredist\vcredist_x64.exe
Workingdir={src}
Parameters=/Q
Flags=waituntilterminated 
;Checks=IsWin64 and Installredist and CheckError
For descriptions of Sectio, please reference inno help file
Section - [RUN]

Code is Written by me.
Reply With Quote
The Following 5 Users Say Thank You to Gupta For This Useful Post:
Cesar82 (28-03-2017), EzzEldin16 (05-01-2018), Razor12911 (14-03-2017), Simorq (16-07-2017), TWOELV (13-03-2017)