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
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
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.