Ask Your Question
2

How to execute a program in Code section of Inno Setup after it has been downloaded?

asked 2023-06-27 20:48:54 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-27 21:01:02 +0000

djk gravatar image

To execute a program in the Code section of Inno Setup after it has been downloaded, you can use the Exec function in the CurStepChanged event function. Here's an example:

[Code]

procedure CurStepChanged(CurStep: TSetupStep);
var
  ResultCode: Integer;
begin
  if CurStep = ssDone then
  begin
    if MsgBox('Do you want to launch the downloaded program now?', mbConfirmation, MB_YESNO) = IDYES then
    begin
      // Replace "downloaded_program.exe" with the actual name of the program you want to execute
      Exec(ExpandConstant('{tmp}\downloaded_program.exe'), '', '', SW_SHOW, ewNoWait, ResultCode);
    end;
  end;
end;

This code will wait until the installation is complete and the user has clicked the "Finish" button, and then prompt the user if they want to launch the downloaded program. If the user clicks "Yes", the Exec function will launch the program with the specified path and parameters ('', in this case), and the ewNoWait flag will allow the installation to continue without waiting for the program to finish executing.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-27 20:48:54 +0000

Seen: 11 times

Last updated: Jun 27 '23