Not show the user information page if there is an ini file with all fields filled

北城余情 提交于 2020-01-17 04:28:08

问题


I have a code on my page for information about the user that once filled writes the data written to an ini file. Will always be to open the installer it is possible to read the file ini filling user data and are all filled back not to show the user information page?

in other words... open the installer, the user information page fills the fields

// create the input query page
  InputPage := CreateInputQueryPage(wpWelcome, 'User Information',' Add the following information! ',' Please fill in the following fields to keep updated database users.');
  // add an edit box and remember its index; False means it is not a password edit
  //name
  EditIndex1 := InputPage.Add('Name:', False);

  // bind events to the just added edit box
  //InputPage.Edits[EditIndex1].OnChange := @MyEditChange;
  InputPage.Edits[EditIndex1].OnKeyPress := @MyEditKeyPress;

  //labels: SetBounds(aLeft, aTop, aWidth, aHeight);
  InputPage.PromptLabels[EditIndex1].SetBounds(10,40,90,20);
  InputPage.Edits[EditIndex1].SetBounds(100,40,240,40);
  InputPage.Edits[EditIndex1].MaxLength:=35

  //username
  EditIndex2 := InputPage.Add('Username:', False);
  InputPage.Values[EditIndex2]:= ExpandConstant('{username}');
  InputPage.PromptLabels[EditIndex2].SetBounds(10,65,90,20);
  InputPage.Edits[EditIndex2].SetBounds(100,65,60,40);
  InputPage.Edits[EditIndex2].MaxLength:=7
  InputPage.Edits[EditIndex2].ReadOnly:=true;
  InputPage.Edits[EditIndex2].Color:=clBtnFace;

  //hostname
  EditIndex3 := InputPage.Add('Computername:', False);
  InputPage.Values[EditIndex3]:= ExpandConstant('{computername}');
  InputPage.PromptLabels[EditIndex3].SetBounds(10,90,90,20);
  InputPage.Edits[EditIndex3].SetBounds(100,90,100,40);
  InputPage.Edits[EditIndex3].MaxLength:=15
  InputPage.Edits[EditIndex3].ReadOnly:=true;
  InputPage.Edits[EditIndex3].Color:=clBtnFace;

  //e-mail
  EditIndex4 := InputPage.Add('E-mail:', False);
  InputPage.PromptLabels[EditIndex4].SetBounds(10,115,90,20);
  InputPage.Edits[EditIndex4].SetBounds(100,115,130,40);
  InputPage.Edits[EditIndex4].OnKeyPress:=@isAt;

  //@
  EditIndex5 := InputPage.Add('@', False);
  InputPage.PromptLabels[EditIndex5].SetBounds(235,115+3,10,20);
  InputPage.Edits[EditIndex5].SetBounds(250,115,70,40);
  InputPage.Edits[EditIndex5].OnKeyPress:=@noAt;
  InputPage.Edits[EditIndex5].MaxLength:=10;
  InputPage.Edits[EditIndex5].Text:='';

  //phone
  EditIndex6 := InputPage.Add('Phone:', False);
  InputPage.Edits[EditIndex6].OnKeyPress:=@NumbersOnly;
  InputPage.PromptLabels[EditIndex6].SetBounds(10,140,90,20);
  InputPage.Edits[EditIndex6].SetBounds(100,140,80,40);
  InputPage.Edits[EditIndex6].MaxLength:=9

  //extension
  EditIndex7 := InputPage.Add('Extension:', False);
  InputPage.Edits[EditIndex7].OnKeyPress:=@NumbersOnly;
  InputPage.PromptLabels[EditIndex7].SetBounds(10,165,90,20);
  InputPage.Edits[EditIndex7].SetBounds(100,165,60,40);
  InputPage.Edits[EditIndex7].MaxLength:=5

  //mobile
  EditIndex8 := InputPage.Add('Mobile:', False);
  InputPage.Edits[EditIndex8].OnKeyPress:=@NumbersOnly;
  InputPage.PromptLabels[EditIndex8].SetBounds(10,190,90,20);
  InputPage.Edits[EditIndex8].SetBounds(100,190,80,40);
  InputPage.Edits[EditIndex8].MaxLength:=9

end;

and creates the INI file

procedure CurStepChanged(CurStep: TSetupStep);
var
  I: Integer;
  FileName, DateTime: String;

begin
DateTime:=GetDateTimeString('dd/mm/yyyy hh:nn', '-', ':');

For I:=0 to WizardForm.ComponentsList.Items.Count - 1 do
      If WizardForm.ComponentsList.Checked[I] then
  // if the installation has just finished, save the edit box text into a file

    case CurStep of
        ssInstall :
      SaveStringToFile(ExpandConstant('C:\dir\User.ini'), '[Date/Time] ' + DateTime + #13#10 + '[Version/Build] 2.4_4.2.3_rev4_25Jul14' + #13#10 + '[Name] ' + InputPage.Edits[EditIndex1].Text + #13#10 + '[Username] ' + InputPage.Edits[EditIndex2].Text + #13#10 + '[Computername] ' + InputPage.Edits[EditIndex3].Text + #13#10 + '[E-mail] ' + InputPage.Edits[EditIndex4].Text +
      '@' + InputPage.Edits[EditIndex5].Text + #13#10 + '[Phone] ' + InputPage.Edits[EditIndex6].Text + #13#10 + '[Extension] ' + InputPage.Edits[EditIndex7].Text + #13#10 + '[Mobile] ' + InputPage.Edits[EditIndex8].Text + #13#10 + #13#10, True)
  end;
end;

the next time you run the installer it reads the information from the ini and if the fields are not filled 7 shows the user information page.

can help me? Tanks.

来源:https://stackoverflow.com/questions/25183287/not-show-the-user-information-page-if-there-is-an-ini-file-with-all-fields-fille

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!