I have added a checkbox in postinstall:
[Run]
Filename: {sys}\sc.exe; Description: "This is checkbox"; Flags: postinstall shellexec runasoriginaluser unchecked
I want to trigger a function when clicking the button Finish if the checkbox is checked. How can I check the value?
What I actually needed to do was the following:
[Run]
Filename: "{code:MyFunction}"; Description: "This is a checkbox"; Flags: skipifdoesntexist postinstall skipifsilent
[Code]
function MyFunction(Param: String): String;
var
ResultCode: Integer;
begin
//My code
Result := '';
end;
This will trigger MyFunction after pressing Finish only if checkbox is checked. The flag skipifdoesntexist is important here. It prevents error when the required exe file doesn't exist.