in my setup i need to check if a program is installed and if not i need to install it before my app installation. I don't know how to extract needed files before [Files] section This is my code:
[Files]
Source: "..\PREREQUIREMENTS\DicomObjects\DicomObjectsSetup43.exe"; DestDir: "{src}\PreReq\DO\Setup\"; DestName: "DOSETUP.exe"; Flags: ignoreversion
Source: "..\PREREQUIREMENTS\DicomObjects\License\DicomObjects.lic"; DestDir: "{src}\PreReq\DO\Lic\"; Flags: ignoreversion
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
if not FileExists(ExpandConstant('"{pf}\Medical Connections\DicomObjects\DicomObjects.ocx"'))then if MsgBox ('installazione DO', mbInformation, mb_YesNo) = idYes then
begin
Exec(ExpandConstant('{src}\PreReq\DO\Setup\DOSETUP.exe'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode);
Exec('cmd.exe','/c COPY "{src}\PreReq\DO\Lic\*.*" "{pf}\Medical Connections\DicomObjects\"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end;
I also tried this code but not work
function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
if not FileExists(ExpandConstant('"{pf}\Medical Connections\DicomObjects\DicomObjects.ocx"'))then
begin
ExtractTemporaryFile('DOSETUP.exe');
Exec(ExpandConstant('{src}\PreReq\DO\Setup\DOSETUP.exe'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode);
Exec('cmd.exe','/c COPY "{src}\PreReq\DO\Lic\*.*" "{pf}\Medical Connections\DicomObjects\"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end;