Inno Setup-从CreateInputDirPage获取数据以将文件放入选定的文件夹

时间:2019-05-21 13:00:41

标签: inno-setup

我写了一个脚本,该脚本应该安装在Program Files文件夹中,并将文件添加到所选的另一个文件夹中

[Code]
var
  OutputProgressWizardPage: TOutputProgressWizardPage;
  OutputProgressWizardPageAfterID: Integer;
  PythonHome: String;
procedure InitializeWizard;
var
  //InputQueryWizardPage: TInputQueryWizardPage;
  //InputOptionWizardPage: TInputOptionWizardPage;
  InputDirWizardPage: TInputDirWizardPage;
  PrimaryServerPage: TInputQueryWizardPage;
  InputFileWizardPage: TInputFileWizardPage;
  OutputMsgWizardPage: TOutputMsgWizardPage;
  OutputMsgMemoWizardPage: TOutputMsgMemoWizardPage;
  AfterID: Integer;
begin
  //WizardForm.PasswordEdit.Text := '{#Password}';

  AfterID := wpSelectTasks;

  //AfterID := CreateCustomPage(AfterID, 'CreateCustomPage', 'ADescription').ID;

  //InputQueryWizardPage := CreateInputQueryPage(AfterID, 'CreateInputQueryPage', 'ADescription', 'ASubCaption');
  //InputQueryWizardPage.Add('&APrompt:', False);
  //AfterID := InputQueryWizardPage.ID;

  //InputOptionWizardPage := CreateInputOptionPage(AfterID, 'CreateInputOptionPage', 'ADescription', 'ASubCaption', False, False);
  //InputOptionWizardPage.Add('&AOption');
  //AfterID := InputOptionWizardPage.ID;

  InputDirWizardPage := CreateInputDirPage(AfterID, 'Choose Python Home Folder', '', '', False, '');
  InputDirWizardPage.Add('&Location of Python Home:');
  InputDirWizardPage.Values[0] := 'C:\Python27';
  AfterID := InputDirWizardPage.ID;
  ...
  ...
 end

function NextButtonClick(CurPageID: Integer): Boolean;
var
  Position, Max: Integer;
begin
  if CurPageID = OutputProgressWizardPageAfterID then begin
    try
      Max := 25;
      for Position := 0 to Max do begin
        OutputProgressWizardPage.SetProgress(Position, Max);
        if Position = 0 then
          OutputProgressWizardPage.Show;
        Sleep(2000 div Max);
      end;
    finally
      OutputProgressWizardPage.Hide;
    end;
  end;
  Result := True;
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
  if SuppressibleMsgBox('Do you want to stop Setup at the Preparing To Install wizard page?', mbConfirmation, MB_YESNO, IDNO) = IDYES then
    Result := 'Stopped by user';
end;

function GetPythonHome(Param: String): string;
begin
  Result := PythonHome;
end;

无论我要求我选择“ Python文件夹”的“安装程序”页面中的文件夹如何更改,它始终会采用默认建议-C:\ Python27。

我该如何克服?我必须做出什么改变?似乎也没有关于Inno Setup Scripting的在线手册。请帮助我

[Files]部分-

[Files]
  Source: "C:\Users\pnarendr\Desktop\API_DAST\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
  **; Not taking in changed PythonHome**
  Source: "C:\Users\pnarendr\Desktop\output.log"; DestDir: "{code:GetPythonHome}";

0 个答案:

没有答案