如何在 Inno Setup UninstalledAll 消息中使用 {app} 路径名?

How to use the {app} path name in Inno Setup UninstalledAll message?

我在 Inno Setup 的消息中看到了如何使用宏 [name][ver]。有什么方法可以使用应用程序路径(由 {app} 在 Inno Setup 的其他地方指定)?当我卸载我的应用程序时,我想告诉用户磁盘上仍然存在一个具有应用程序路径名的文件,并且有一个包含它的环境变量。我不想删除带有路径名的文件,也不想清除变量,因为它们中可能有其他路径,但我确实想警告用户。

这是我要修复的 Inno Setup 条目:

[Messages]
UninstalledAll=%1 uninstall complete.%n%nI did not try to remove the APP-PATHNAME-HERE from the PATH16 environment variable, or from the PATH statement in autoexec.bat in your otvdm\C folder. You may safely ignore these.

这不是 自定义消息。这是一个标准的消息。您不能以这种方式修改标准消息。

您所能做的就是显示另一条消息。例如来自 CurUninstallStepChanged(usPostUninstall).

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
  Message: string;
begin
  if CurUninstallStep = usPostUninstall then
  begin
    Message :=
      Format('I did not try to remove the %s from the PATH16 environment variable, ' +
        'or from the PATH statement in autoexec.bat in your otvdm\C folder. ' +
        'You may safely ignore these.', [ExpandConstant('{app}')]);
    MsgBox(Message, mbInformation, MB_OK);
  end;
end;