gpt4 book ai didi

inno-setup - Inno 安装程序 : how to use {app} in InitializeWizard?

转载 作者:行者123 更新时间:2023-12-03 18:26:58 29 4
gpt4 key购买 nike

我知道this question was asked before几乎相同的标题。但是答案没有为我提供足够的信息来解决问题。我的问题也有点不同。

我正在使用 Inno Download Plugin

我的来源看起来像

[Components]
Name: "dl"; Description: "{cm:DLMessage}"; Types: full fullService
Name: "dl\aaa"; Description: "aaa111"; Types: full fullService;
Name: "dl\bbb"; Description: "bbb222"; Types: full fullService;
Name: "dl\ccc"; Description: "ccc333"; Types: full fullService;

[Code]
procedure InitializeWizard();
begin
idpAddFileComp('ftp://user:pass@server.xy/folder/myFile1.exe', ExpandConstant('{app}\subfolder\Download\myFile1.exe'), 'dl\aaa');
idpAddFileComp('ftp://user:pass@server.xy/folder/myFile2.exe', ExpandConstant('{app}\subfolder\Download\myFile2.exe'), 'dl\bbb');
idpAddFileComp('ftp://user:pass@server.xy/folder/myFile3.exe', ExpandConstant('{app}\subfolder\Download\myFile3.exe'), 'dl\ccc');
idpDownloadAfter(wpReady);
end;

我想要实现的是根据对组件所做的选择下载一些文件。

由于我对 inno 比较陌生...答案

Prototype:

function WizardDirValue: String;

对我说同样的话,就像你试着告诉牙医如何修理汽车一样:)

我想在 InitializeWizard 中使用 {app} 但我不知道如何使用,即使有给定的“提示”。任何人都可以向我解释这个吗? (谷歌并没有真正帮助我)

最佳答案

InitializeWizard向导表单创建后立即触发事件方法,因此将 {app} 目录传递给插件还为时过早(WizardDirValue 函数会做同样的事情) ,因为用户还没有通过目录输入页面。您需要将代码移动到用户选择目录后触发的事件中。

尝试这样的事情:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Code]
procedure InitializeWizard;
begin
// only tell the plugin when we want to start downloading
idpDownloadAfter(wpReady);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
// if the user just reached the ready page, then...
if CurPageID = wpReady then
begin
// because the user can move back and forth in the wizard, this code branch can
// be executed multiple times, so we need to clear the file list first
idpClearFiles;
// and add the files to the list; at this time, the {app} directory is known
idpAddFileComp('ftp://user:pass@server.xy/folder/myFile1.exe', ExpandConstant('{app}\subfolder\Download\myFile1.exe'), 'dl\aaa');
idpAddFileComp('ftp://user:pass@server.xy/folder/myFile2.exe', ExpandConstant('{app}\subfolder\Download\myFile2.exe'), 'dl\bbb');
idpAddFileComp('ftp://user:pass@server.xy/folder/myFile3.exe', ExpandConstant('{app}\subfolder\Download\myFile3.exe'), 'dl\ccc');
end;
end;

关于inno-setup - Inno 安装程序 : how to use {app} in InitializeWizard?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30100311/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com