从Pascal代码更改Inno Setup消息 [英] Change Inno Setup messages from Pascal code

查看:59
本文介绍了从Pascal代码更改Inno Setup消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要专门从脚本中更改ConfirmUninstallUninstalledMost(以防万一)和UninstalledAll来设置条件.像这样:

I need to change ConfirmUninstall, UninstalledMost (just in case), and UninstalledAll specifically from script to set a condition. Something like this:

if FileExists(ExpandConstant('{app}\Slash.exe')) then
  SetupMessage(msgConfirmUninstall) := FmtMessage(SetupMessage(msgConfirmUninstall), ['Dagon Slasher'])
else if FileExists(ExpandConstant('{app}\Frank.exe')) then
  SetupMessage(msgConfirmUninstall) := FmtMessage(SetupMessage(msgConfirmUninstall), ['Dagon Frankenstein'])
else
  SetupMessage(msgConfirmUninstall) := FmtMessage(SetupMessage(msgConfirmUninstall), ['Dagon Video Tools']);

但这不起作用.这些消息用在MsgBox es中,所以我想不出其他任何方式. 以静默方式运行不太适合我,因为如果程序(或其中一个)具有以下功能,则安装程序将运行卸载程序已经安装,所以我不希望用户通过运行安装程序意外卸载程序.

But this doesn't work. These messages are used in MsgBoxes, so I can't think of any other way. Running in silent mode is not really suitable for me, since setup will run uninstall if the programs (or one of them) has already been installed, so I don't want the user to accidentally uninstall the program by running the setup.

推荐答案

您无法轻松更改它们,请参见:
在Inno Setup中替换或自定义模式卸载窗口

You cannot change these easily, see:
Replace or customize modal uninstallation windows in Inno Setup

关于静默卸载解决方案:我不理解您的问题,程序(或其中之一)已经安装"..

我假设您仅在用户确认要安装新版本后才运行卸载程序,因此您实际上是想静默运行卸载程序,对吗?

I assume you run the uninstaller only after the user confirms (s)he wants to install the new version, so you actually want to run the uninstaller silently, right?

无论如何,即使添加/删除程序" 中的条目引用了"silent",也没有阻止您从安装程序非静默地运行卸载程序的因素.安装.

And anyway, there's nothing that prevents you from running the uninstaller non-silently from your installer, even if the entry in "Add/Remove programs" refers to "silent" installation.

您可以使用涵盖所有设置类型的通用消息:

You can use generic messages that covers all setup types:

[Messages]
ConfirmUninstall=Are you sure you want to completely remove this game?


由于您的卸载消息取决于安装的应用程序的类型,因此可以将安装程序修改为:


As your uninstall messages depend on a type of the installed application, you can modify the installer to:

  • 创建自定义类型"页面(如菜单)作为第一个页面.
  • 用户选择类型"后,请使用自定义开关(例如/APPTYPE=slasher)重新启动安装程序并退出.
  • 一旦使用/APPTYPE(重新)运行安装程序,便从一开始就知道要安装的组件/类型,因此可以相应地设置AppName(使用
  • Create custom "type" page (like a menu) as the very first one.
  • Once the user selects the "type", restart the installer with a custom switch (e.g. /APPTYPE=slasher) and exit.
  • Once the installer is (re-)run with the /APPTYPE, you know from the beginning, what component/type you are installing and hence you can set the AppName accordingly (using a scripted constant).
  • Of course, you skip the custom "type" page.

这实际上并不难实现.唯一的缺点是设置窗口是重新创建"的.用户选择类型"后.

This is actually not difficult to implement. The only drawback is that the setup window is "recreated" after the user selects the "type".

我已经在对 Inno设置基于所选组件更改AppName的答案中已经草绘了此解决方案.

I've sketched this solution already in my answer to Inno Setup Change AppName based on component(s) selected.

这篇关于从Pascal代码更改Inno Setup消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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