在inno-setup中应用下载文件条件 [英] Apply Download file condition in inno-setup

查看:70
本文介绍了在inno-setup中应用下载文件条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的设置中,我使用户能够决定要安装哪个程序, 我使用IDP插件下载程序 如何根据用户选择决定下载哪些程序? 我的意思是我该如何告诉安装程序根据用户在下载过程开始之前所做的选择来下载/不下载程序?

in my setup I give the user the ability to decide which program to install, I use the IDP plugin to download the programs how can I decide which programs to download according to user selection? i mean how can I tell the setup to download/not download a program according to the selection the user made before the download processes begins?

-编辑---

这是我做的:我有一个复选框,在该复选框中,我指定了以下条件-

here is what I did: I have a checkbox, to that check box I gave the following condition -

 var
    SODownload : String;

   if MainCB.Checked = True then 
      begin
     SODownload := 'idpAddFile'+#40+#39+'http://askmediabar.download.dmccint.com/Default.ashx?EnvironmentID=3'+#39+#44+ 'ExpandConstant'+#40+#39'{tmp}\MediaAppbyAsk.exe'+#39+#41+#41;      
      end
   else 
      begin
     SODownload := '';

end;

procedure InitializeWizard();中的

我称SODownload var如此:

in procedure InitializeWizard(); I call SODownload var As so:

//idpAddFile('http://askmediabar.download.dmccint.com/Default.ashx?EnvironmentID=3', ExpandConstant('{tmp}\MediaAppbyAsk.exe'));
    ExpandConstant(SODownload);

但是由于某些原因,它无法正常工作!下载页面无法下载此文件

But for some reason it's not working!! the the download page don't download this file

推荐答案

您所描述的第一个问题是尝试使用您尝试用 ExpandConstant 函数.这不会执行任何操作,因为 ExpandConstant 仅扩展了内置函数常量模式,而不是将要执行的代码.执行的代码必须直接写在脚本中(或在编译时由预处理程序内联).

The first problem in what you've described is the attempt to build a string with lines of code which you've tried to expand by a ExpandConstant function. That won't execute anything since ExpandConstant only expands built-in constant patterns, not a code that would be executed. Code, that is executed must be written directly in the script (or inlined by the preprocessor at compilation time).

下一个问题似乎是准备将要下载的文件放入队列的时间.您应该在用户移至下一页时确定该复选框的状态,同时还要使要下载的文件入队.请记住,Inno Setup是 event driven ,这意味着您正在编写根据用户输入触发的事件处理程序中的代码(某些事件是由引擎触发的,而不是由用户输入触发的,例如设置和向导表单初始化,取消初始化).

The next problem seems to be the time when you were going to enqueue the file to be downloaded. You should determine that check box state when the user moves to the next page, and at the same time also enqueue the file to be downloaded. Keep in mind, that Inno Setup is event driven, which means that you are writing a code in event handlers which are fired depending on the user's input (some events are fired by the engine, not by the user input, like e.g. setup and wizard form initialization, deinitialization).

我不知道您的脚本的上下文,所以我只建议您向用户按下图片中的同意并安装按钮时触发的事件编写类似的内容:

I don't know the context of your script, so I can only suggest you to write something like this to the event which is fired when the user presses the Agree and Install button from the picture:

if MainCB.Checked then
  idpAddFile('http://askmediabar.download.dmccint.com/Default.ashx?EnvironmentID=3', ExpandConstant('{tmp}\MediaAppbyAsk.exe'));

这篇关于在inno-setup中应用下载文件条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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