Reputation: 1029
How do you make Inno Setup disable CreateUninstallRegKey
via code?
My setup.exe file created in Inno Setup accepts parameters, e.g.:
setup.exe -a
or
setup.exe -b
If -a
parameter is supplied, then enable CreateUninstallRegKey
, or if -b
parameter is supplied, then disable CreateUninstallRegKey
.
Is there anyway to set CreateUninstallRegKey
via code or do I have to make a function then call the function in script section?
This help page explains about using {code:...}
constants, but unfortunately I got this error:
Thanks
Upvotes: 3
Views: 636
Reputation: 76683
Do not use the {code:}
expression for passing values to Boolean type directives. Do it this way:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
CreateUninstallRegKey=NeedsUninstallRegKey
[Code]
function CmdLineParamExists(const Value: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to ParamCount do
if CompareText(ParamStr(I), Value) = 0 then
begin
Result := True;
Exit;
end;
end;
function NeedsUninstallRegKey: Boolean;
begin
Result := CmdLineParamExists('-a');
end;
Upvotes: 5