预期的inno设置标识符

时间:2015-09-09 15:11:51

标签: deployment dependencies inno-setup

所以我在Inno Setup Script IDE中得到了一个标识符预期错误,我想知道如何修复它。这与安装程序所需的依赖关系(如果它不存在)有关。该守则如下:

[code]
function FrameworkIsNotInstalled: Boolean; 
begin
  Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');
end;
procedure InstallFramework;
var
  StatusText: string;
  ResultCode: Integer;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing .NET framework...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
       MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
         mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
function isADBinstalled: Boolean; //error occurs on this line
begin
  Result := not DirExists(ExpandConstant '{sd}\adb');
procedure installadb
var
StatusText: string;
begin
StatusText := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := 'Installing ADB this shouldnt be long...';
WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\adb-setup-1.4.2.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
       MsgBox('ADB Install failed with code: ' + IntToStr(ResultCode) + '.',
         mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal; 
end;

end;

1 个答案:

答案 0 :(得分:1)

您忘记了end个关键字几次。

function FrameworkIsNotInstalled: Boolean; 
begin
  Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');
end;

procedure InstallFramework;
var
  StatusText: string;
  ResultCode: Integer;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing .NET framework...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end; // you forgot this

function isADBinstalled: Boolean; //error occurs on this line
begin
  Result := not DirExists(ExpandConstant '{sd}\adb');
end; // you forgot this  

procedure installadb; // you forgot the semicolon
var
  StatusText: string;
begin
  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing ADB this shouldnt be long...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant('{tmp}\adb-setup-1.4.2.exe'), '/p /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      MsgBox('ADB Install failed with code: ' + IntToStr(ResultCode) + '.',
        mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal; 
  end; // you forgot this 
end;    

您可以通过正确格式化代码来避免这些错误。每次键入begin时,都应直接键入相应的end。对括号和引号执行相同操作。