仅将Inno Setup UI用作自解压器-无需安装 [英] Use Inno Setup UI as a self-extractor only - No installation

查看:321
本文介绍了仅将Inno Setup UI用作自解压器-无需安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Inno Setup用于许多标准"安装程序,但是对于此任务,我需要提取一堆临时文件,运行其中一个临时文件,然后将其删除并退出安装程序(实际上没有安装任何东西).

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).

基本上,我希望在不使用安装程序"的情况下创建一个自解压程序,并且正在寻求通过inno设置获得最佳用户体验的方法.

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;

问题在于,我在这里能做的最好的事情是显示一个消息框请稍等一两分钟...",用户单击[确定],然后等待,因为屏幕上没有任何显示的内容,但没有任何反应全部,然后MyScript.exe开始.

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.

我想要的是一个向导页面,该页面带有npbstMarquee样式进度条,上面写着请稍等,正在提取临时文件...",然后在提取文件并启动脚本后消失.

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.

我不认为有一种方法可以告诉Inno Setup在ExtractTemporaryFiles()进行时显示进度条(这是理想的选择),并将其处理到自定义向​​导页面中会让我感到困惑.

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.

推荐答案

  • 将文件安装"到{tmp},而不是使用ExtractTemporaryFiles;
  • 执行从Run部分提取到{tmp}的文件(或在安装文件后使用AfterInstall参数或CurStepChanged触发Pascal脚本代码);
  • Uninstallable 设置为no
  • CreateAppDir 设置为no;
  • 使用 [Messages]部分来编辑向导文本以安装者为中心,满足您的需求.
    • "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"
      

      注意:

      • {tmp}文件夹在安装程序"关闭时自动删除;
      • 在安装到新的空文件夹时,不需要ignoreversion标志.
      • The {tmp} folder gets automatically deleted, when the "installer" is closing;
      • No need for ignoreversion flag, when installing to new empty folder.

      有关字面问题的解答,请参见 Inno设置:ExtractTemporaryFile导致向导冻结.或更常见的问题: Inno设置:如何修改长时间运行的脚本以使其不会冻结GUI?

      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?

      这篇关于仅将Inno Setup UI用作自解压器-无需安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆