Inno Setup Pascal 脚本问题... "Unknown Identifier"

Inno Setup Pascal script problem... "Unknown Identifier"

我正在尝试检查 java 8 是否在注册表中或 java 9-11 在注册表中,所以我制作了这个脚本:

[Code]
{ Script to check if a JRE is installed, it will search for the old java 8 location and for the new java 11 location }  
function InitializeSetup(): Boolean;
var
  ErrorCode: Integer;
  JavaVer: string;
begin
    { checking for old java 8 location }  
    RegQueryStringValue(
        HKLM64, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
    ResultOldJava := (Length(JavaVer) > 0);

    { checking for new java 9-11 location }  
    RegQueryStringValue(
        HKLM64, 'SOFTWARE\JavaSoft\JDK', 'CurrentVersion', JavaVer);
    ResultNewJava := (Length(JavaVer) > 0);

    if not ResultOldJava and not ResultNewJava then
    begin
        if MsgBox('ATENCIÓN: Gestor requiere Java 64 Bits instalado en el sistema. No se ha encontrado, ¿Desea abrir la página de descargas oficial? Por favor, recuerde que es necesaria la versión de 64 bits.', mbConfirmation, MB_YESNO) = idYes then
        begin
            ShellExec(
              'open', 'https://www.java.com/es/download/manual.jsp#win',
              '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
        end;
    end;
end;

问题是它正在打印此错误:

Unknown Identifier 'ResultOldJava'

怎么了?我的 pascal 水平很低

您已声明 ResultOldJava 变量,与您已声明 ErrorCodeJavaVer 的方式相同:

function InitializeSetup(): Boolean;
var
  ErrorCode: Integer;
  JavaVer: string;
  ResultOldJava: Boolean; 
begin

对于其他人,他们带着相同的错误消息到达这里,但是在 functionprocedure 调用上,而不是在变量标识符上,请参阅 .