Inno Setup Pascal脚本问题...“未知标识符" [英] Inno Setup Pascal script problem... "Unknown Identifier"
问题描述
我正在尝试检查Java 8是否在注册表中或Java 9-11是否在注册表中,所以我编写了此脚本:
I'm trying to check if java 8 is in registry or java 9-11 are in registry, so i make this script:
[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;
问题在于它正在打印此错误:
The problem is that it's printing this error:
Unknown Identifier 'ResultOldJava'
怎么了?我在帕斯卡的技能很低
What is wrong? my skills in pascal are very low
推荐答案
您已经声明了 ResultOldJava
变量,就像您已经声明了 ErrorCode
和 JavaVer一样.
:
You have declare the ResultOldJava
variable, the same way you already declare ErrorCode
and JavaVer
:
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
JavaVer: string;
ResultOldJava: Boolean;
begin
对于其他人来说,带着相同的错误消息到达这里,但是通过 function
或 procedure
调用,而不是通过变量标识符进行访问,请参见
For others, who arrive here with the same error message, but on a function
or procedure
call, rather than on a variable identifier, see Inno Setup - Pascal code visibility - "Unknown identifier" error.
这篇关于Inno Setup Pascal脚本问题...“未知标识符"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!