Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
600 views
in Technique[技术] by (71.8m points)

progress - Use Inno Setup UI as a self-extractor only - No installation

I use Inno Setup for many "standard" installers, but for this task I need to extract a bunch of temp files, run one of them, then remove them and exit the installer (without actually installing anything).

Basically I'm looking to make a self-extractor with without it being an "installer", and am after the best user experience possible with inno setup.

I have the following code which almost works fine:

[Files]
Source: "dist*"; Flags: recursesubdirs ignoreversion dontcopy;
[Code]
function InitializeSetup(): Boolean;
var
  ResultCode: Integer;
begin
  Result := True;
  MsgBox('Please wait a minute or two...', mbInformation, MB_OK);
  ExtractTemporaryFiles('{tmp}*');
  Exec(ExpandConstant('{tmp}MyScript.exe'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
  Abort();
end;

The problem is that the best I can do here is show a message box "Please wait a minute or two...", the user clicks [Ok], then waits as nothing appears to happen with nothing on-screen at all, then MyScript.exe starts.

What I'd like instead is a Wizard page saying "Please wait as temporary files are extracted..." with a npbstMarquee style progress bar, then is disappears once the files are extracted and my script starts.

I don't think there's a way to tell Inno Setup to display a progress bar while ExtractTemporaryFiles() is going (which would be ideal) and working this into a custom wizard page has got me baffled.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  • "Install" the files to {tmp}, instead of using ExtractTemporaryFiles;
  • Execute the files extracted to {tmp} from Run section (or use AfterInstall parameter or CurStepChanged to trigger Pascal Script code after files are installed);
  • Set Uninstallable to no;
  • Set CreateAppDir to no;
  • Use [Messages] section to edit the wizard texts that are too installer-centric for your needs.
[Setup]
Uninstallable=no
CreateAppDir=no

[Files]
Source: "dist*"; DestDir: {tmp}; Flags: recursesubdirs

[Run]
FileName: "{tmp}MyScript.exe"

Notes:

  • The {tmp} folder gets automatically deleted, when the "installer" is closing;
  • No need for ignoreversion flag, when installing to new empty folder.

A related question: Inno Setup installer that only runs a set of embedded installers


For an answer your literal question, see Inno setup: ExtractTemporaryFile causes wizard freeze. Or a more generic question on the topic: Inno Setup: How to modify long running script so it will not freeze GUI?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...