1

I have an NSIS installer script that I want to convert into Inno Setup. NSIS version can show progress of 3rd party extraction(7z), also the files being extracted.

These are the codes to get and display progress and current file from NSIS script.

GetFunctionAddress $R2 UpdateProgressBar

ExecDos::exec /TOFUNC '7za.exe x "Package/achivefile.pak" -o"./installDir" -r -aoa -bb' '' $R2

This is general 7z extraction command:

7za.exe x ".\Package\achivefile.pak" -o".\SomeDestination" -r -aoa -bb

The command line output of extracting the file is something similar to:

7z extraction output

Now I want to make same/similar stuff with Inno Setup, read/get output of extraction process. However I can't find a similar command/method to achieve the same result.

Update: I can execute an external application. My question is how to integrate the output of external application (7z in this context) with progress of Inno Setup installing process

Yunus Yurtturk
  • 509
  • 1
  • 8
  • 26
  • See [How to add .arc decompression to Inno Setup?](https://stackoverflow.com/q/42738646/850848) – Martin Prikryl Jul 03 '23 at 11:22
  • Out of curiosity, is it this hard to get output of an exec result? I'm sure it works but I can't even read the script easily so that makes me think if I'm doing something wrong. – Yunus Yurtturk Jul 03 '23 at 12:07
  • I'm also checking this answer: https://stackoverflow.com/a/41059605/1493265 – Yunus Yurtturk Jul 03 '23 at 12:10
  • I do not know any easier way in Inno Setup. – Martin Prikryl Jul 03 '23 at 12:46
  • 2
    If even you don't know, then it doesn't exist. :) – Yunus Yurtturk Jul 03 '23 at 13:35
  • What is the point of the NSIS tag here? – Anders Jul 03 '23 at 22:14
  • You should be able to use the Pascal Scripting Exec function for executing 7za.exe, see https://jrsoftware.org/ishelp/index.php?topic=isxfunc_exec – Matej Jul 04 '23 at 08:01
  • InnoSetups `Exec` function doesn't support reading of the process output which would be necessary to show progress and files being extracted. Furthermore, you need a way to read process output in a streaming way, to show progress _while_ files are being extracted. It _should_ be possible by calling WinAPI functions like `CreateProcess`, `CreatePipe` and `ReadFile`, but it's not trivial (see [example in C](https://learn.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output)). – zett42 Jul 07 '23 at 13:11
  • Another way is to redirect process output to a file, which is relatively easy using `cmd` and then monitor the file for changes, read its contents and show it in InnoSetup UI. See [example](https://stackoverflow.com/a/56912589/7571258). – zett42 Jul 07 '23 at 13:18

0 Answers0