【发布时间】:2017-07-24 20:01:29
【问题描述】:
作为 Inno Setup 内置安装程序的一部分,我想将用户在安装程序中输入的文本字段输出到文本文件。
到目前为止,我有以下内容:
[Code]
var
PrimaryServerPage: TInputQueryWizardPage;
PrimaryAddress: String;
procedure InitializeWizard;
begin
PrimaryServerPage := CreateInputQueryPage(wpWelcome,
'Primary Server Details', 'Where is you application installed?',
'Please specify the IP address or hostname of your Primary Server, ' +
'then click Next.');
PrimaryServerPage.Add('Primary Server IP/Hostname:', false);
PrimaryAddress := PrimaryServerPage.Values[0];
SaveStringToFile('c:\filename.txt', PrimaryAddress, True);
end;
但是,当我运行安装程序并输入字段时,它不会输出到文本文件。
如果我将PrimaryServerPage.Values[0] 替换为数字,则会成功输出到文本文件。
任何人都可以就我可能出错的地方提供帮助或提供建议吗?
另外,在此之后,我实际上想将此值输出到现有文本文件的中间,这可能吗?
例如,这是我希望将其插入的配置文件。要添加到ENTER VALUE HERE! 中的值
这可以作为安装的最后一步添加吗?安装完成后配置文件不存在?
###############################################################################
#
# Configuration File.
#
###############################################################################
#
# This file is intended for advanced users. Please consult the documentation
# before modifying this file.
#
# NOTE: The hash (#) represents a comment.
#
#
# Define the name or IP address of the primary server.
# On secondary server installs, this value should be changed to point to the
# primary server.
# Default: 127.0.0.1
# Examples: mainserver.localdomain.com, win2003, 1.2.3.4
#
# IMPORTANT: Please restart the Service" after
# changing this value.
#
ApplicationServer=ENTER VALUE HERE!
工作正在进行中,在查看替换之前一直无法让文本文件输出正常工作(我想我可能误解了关于此的帖子),尽管任何有关这方面的指导都会很棒,因为我确信我没有经验Inno 也会把我赶出去的。
[Code]
var
PrimaryServerPage: TInputQueryWizardPage;
PrimaryAddress: String;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if(CurPageID = wpWelcome) then
begin
PrimaryServerPage := CreateInputQueryPage(wpWelcome,
'Application Server Details', 'Where is your app installed?',
'Please specify the IP address or hostname of your Application Server, ' +
'then click Next.');
PrimaryServerPage.Add('Primary Server IP/Hostname:', false);
PrimaryAddress := PrimaryServerPage.Values[0];
SaveStringToFile('c:\filename.txt', PrimaryAddress, True);
end;
Result :=True;
end;
【问题讨论】:
标签: installation inno-setup pascalscript