inno example

ref: https://jrsoftware.org/ishelp/

; -- AllPagesExample.iss --
; Same as Example1.iss, but shows all the wizard pages Setup may potentially display

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[Setup]
AppName=ALF.1.0
AppVersion=1.0
WizardStyle=modern
DefaultDirName={autopf}\ALF
DefaultGroupName=ALF.1.0
UninstallDisplayIcon={app}\ALF_install.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
//yes/no
DisableWelcomePage=no
//LicenseFile=license.txt
//#define Password 'password'
//Password={#Password}
//Password='222'
//InfoBeforeFile=readme.txt
//UserInfoPage=yes
//PrivilegesRequired=lowest
DisableDirPage=no
DisableProgramGroupPage=no
InfoAfterFile=readme.txt

[Files]
  //Source: "MyProg.exe"; DestDir: "{app}"
  //Source: "MyProg.chm"; DestDir: "{app}"
  //Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
  Source: "*"; DestDir: "{app}"; Excludes: "*.iss,_ALF_installation"; Flags: ignoreversion recursesubdirs

[Icons]
//Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

[Components]
//Name: "component"; Description: "Component";

[Tasks]
//Name: "task"; Description: "Task";

[Code]
var
OutputProgressWizardPage: TOutputProgressWizardPage;
OutputProgressWizardPageAfterID: Integer;

procedure CurStepChanged(CurStep: TSetupStep);
  var
  iFolder: String;
  toMFile,tempStr: String;
  svArray: TArrayOfString;
  nLines,i: Integer;
  adfportalFile,kill_processFile: String;
  begin
    iFolder := ExpandConstant('{app}');
    adfportalFile := ExpandConstant('{app}/exec/scripts/adfportal.bat');
    kill_processFile := ExpandConstant('{app}/exec/scripts/kill_process.bat');
    if CurStep=ssinstall then
      begin
      // todo
      end;
    if CurStep=ssPostInstall then
      begin
        LoadStringsFromFile(adfportalFile, svArray);
        nLines := GetArrayLength(svArray);
        for i := 0 to nLines - 1 do
          begin
          tempStr := svArray[i];
          if (1 < Pos('${installPath}', tempStr)) then
            begin
            //svArray[i] := ExpandConstant(tempStr);
            StringChangeEx(svArray[i], '${installPath}', iFolder, True);
            //StringChangeEx(svArray[i], '\', '/', True);
            end;
          end;
        SaveStringsToFile(adfportalFile, svArray, false);

        LoadStringsFromFile(kill_processFile, svArray);
        nLines := GetArrayLength(svArray);
        for i := 0 to nLines - 1 do
          begin
          tempStr := svArray[i];
          if (1 < Pos('${installPath}', tempStr)) then
            begin
            //svArray[i] := ExpandConstant(tempStr);
            StringChangeEx(svArray[i], '${installPath}', iFolder, True);
            //StringChangeEx(svArray[i], '\', '/', True);
            end;
          end;
        SaveStringsToFile(kill_processFile, svArray, false);

      end;
    if CurStep=ssDone then
      begin
      // todo
      end;

  end;

procedure InitializeWizard;
  var
  InputQueryWizardPage: TInputQueryWizardPage;
  InputOptionWizardPage: TInputOptionWizardPage;
  InputDirWizardPage: TInputDirWizardPage;
  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, 'CreateInputDirPage', 'ADescription', 'ASubCaption', False, 'ANewFolderName');
  InputDirWizardPage.Add('&APrompt:');
  InputDirWizardPage.Values[0] := 'C:\';
  AfterID := InputDirWizardPage.ID;

  InputFileWizardPage := CreateInputFilePage(AfterID, 'CreateInputFilePage', 'ADescription', 'ASubCaption');
  InputFileWizardPage.Add('&APrompt:', 'Executable files|*.exe|All files|*.*', '.exe');
  AfterID := InputFileWizardPage.ID;

  OutputMsgWizardPage := CreateOutputMsgPage(AfterID, 'CreateOutputMsgPage', 'ADescription', 'AMsg');
  AfterID := OutputMsgWizardPage.ID;

  OutputMsgMemoWizardPage := CreateOutputMsgMemoPage(AfterID, 'CreateOutputMsgMemoPage', 'ADescription', 'ASubCaption', 'AMsg');
  AfterID := OutputMsgMemoWizardPage.ID;

  OutputProgressWizardPage := CreateOutputProgressPage('CreateOutputProgressPage', 'ADescription');
  OutputProgressWizardPageAfterID := AfterID;
}
  { See CodeDownloadFiles.iss for a CreateDownloadPage example }
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;}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值