Reputation: 407
Using Inno Setup 6.2, I have icons set up for my app. Based on Components
selection, I need to dynamically add switches to the app's cmd line in the icons. Is there a way to do this?
Upvotes: 2
Views: 76
Reputation: 202534
If the logic is simple, use Components
parameter:
[Icons]
Name: "{autoprograms}\My Program"; Filename: "{app}\MyProg.exe"; \
Parameters: "/Client"; Components: client
Name: "{autoprograms}\My Program"; Filename: "{app}\MyProg.exe"; \
Parameters: "/Server"; Components: server
You can reduce code repetition using preprocessor.
If the logic is more complicated, use:
WizardIsComponentSelected
function to query the components selected.[Icons]
Name: "{autoprograms}\My Program"; Filename: "{app}\MyProg.exe"; \
Parameters: "{code:GetIconParameters}"
[Code]
function GetIconParameters(Param: String): String;
begin
if WizardIsComponentSelected('server') then
Result := '/Server'
else if WizardIsComponentSelected('client') then
Result := '/Client'
else
Result := '';
end;
Upvotes: 4