Input Inno设置:添加第二个自定义输入页面(第一个工作正常)

Input Inno设置:添加第二个自定义输入页面(第一个工作正常),input,inno-setup,Input,Inno Setup,在本论坛专家的帮助下,我使用以下代码向Inno设置脚本添加自定义输入页面: [Code] var UserInputsPage: TInputQueryWizardPage; function GetWatchFolder(Param: string): string; begin Result := UserInputsPage.Values[0]; end; [Code] procedure InitializeWizard; var dfPath: string;

在本论坛专家的帮助下,我使用以下代码向Inno设置脚本添加自定义输入页面:

[Code]

var
  UserInputsPage: TInputQueryWizardPage;

function GetWatchFolder(Param: string): string;
begin
  Result := UserInputsPage.Values[0];
end;

[Code]

procedure InitializeWizard;

var  
  dfPath: string; 
begin

  dfPath := 'C:\TEMP';
  RegQueryStringValue(HKCU, 'SOFTWARE\WPDOS.org', 'FilePrintPath', dfPath );

  { Create the page }
  UserInputsPage :=
    CreateInputQueryPage(wpWelcome,
      'Folder to watch', 'Enter the path to the folder that you want me to watch. I will create it if it does not exist.',
      'Please type a folder path, then click Next.');
  UserInputsPage.Add('Folder to watch:', False);
  UserInputsPage.Values[0] := dfPath;
end;
我现在尝试添加第二个页面以请求第二个输入(另一个文件夹名称)。我编写了以下代码,当我将其添加到现有代码(如上所示)下时,编译器不会抱怨,但在运行脚本时,新页面不会出现

显然,我省略了一些简单而明显的步骤,这些步骤将显示第二页,但这一步骤对我来说并不明显。如果有人能告诉我这一明显的步骤应该是什么,我将非常感激。我已经试验了数小时,但没有成功。下面是第二段代码:

[Code]

var
  UserInputsPage2: TInputQueryWizardPage;

function GetPdfPathFolder(Param: string): string;
begin
  Result := UserInputsPage2.Values[0];
end;

[Code]

var  
  pdfPath: string; 

begin

  pdfPath := '';
  RegQueryStringValue(HKCU, 'SOFTWARE\WPDOS.org', 'pdfPath', pdfPath );

  { Create the page }
  UserInputsPage2 :=
     CreateInputQueryPage(wpWelcome,
      'Folder for saved PDFs', 'By default I will save PDFs to the desktop. If you want to us a different folder, enter its path here. I will create it if it does not exist.',
      'Please type a folder path, then click Next.');
  UserInputsPage2.Add('Folder for saved PDFs (leave blank to use desktop):', False);
  UserInputsPage2.Values[0] := pdfPath;
end.


我不知道你的代码是做什么的,因为你没有提供完整的示例。我使用你的代码作为基础。对
CreateInputQueryPage
调用和
CreateInputQueryPage
调用都使用
wpWelcome
,但我的示例似乎更清晰。我使用的是InnoSetup 6.0.3(u)


谢谢!这太完美了。我想用输入的值向注册表写入一个值,这使我完全可以这样做。你的代码还以我以前没有用过的方式帮助我理解[代码]部分的结构。再次,非常感谢!
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{380D65F4-34C6-4E55-B806-1EE46EEBD2B6}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputBaseFilename=mysetup
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files (x86)\Inno Setup 6\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Code]

var
  UserInputsPage: TInputQueryWizardPage;
  UserInputsPage2: TInputQueryWizardPage;
  pdfPath: string; 

 function GetPdfPathFolder(Param: string): string;
begin
  Result := UserInputsPage2.Values[0];
end;


function GetWatchFolder(Param: string): string;
begin
  Result := UserInputsPage.Values[0];
end;

[Code]

procedure InitializeWizard;

var  
  dfPath: string; 
begin

  dfPath := 'C:\TEMP';
  RegQueryStringValue(HKCU, 'SOFTWARE\WPDOS.org', 'FilePrintPath', dfPath );

  { Create the page }
  UserInputsPage :=
    CreateInputQueryPage(wpWelcome,
      'Folder to watch', 'Enter the path to the folder that you want me to watch. I will create it if it does not exist.',
      'Please type a folder path, then click Next.');
  UserInputsPage.Add('Folder to watch:', False);
  UserInputsPage.Values[0] := dfPath;
  pdfPath := '';
  RegQueryStringValue(HKCU, 'SOFTWARE\WPDOS.org', 'pdfPath', pdfPath );

  { Create the page }
  UserInputsPage2 :=
     CreateInputQueryPage(UserInputsPage.ID,
      'Folder for saved PDFs', 'By default I will save PDFs to the desktop. If you want to us a different folder, enter its path here. I will create it if it does not exist.',
      'Please type a folder path, then click Next.');
  UserInputsPage2.Add('Folder for saved PDFs (leave blank to use desktop):', False);
  UserInputsPage2.Values[0] := pdfPath;
end;