Deselect creation of start menu and desktop icons in "Portable mode" in Inno Setup

Viewed 267

I have the following under [Tasks]

[Tasks]
Name: "desktopicon"; Description: "Create a Desktop shortcut";
Name: "startmenu"; Description: "Create a Start Menu entry";
Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked

and under [Setup]

Uninstallable=not WizardIsTaskSelected('portablemode')

I'd like the desktopicon and startmenu tasks to be deselected when a user selects portablemode, since these options are useless under the portablemode installation configuration:

enter image description here

If there is a cleaner way to do this I am also interested in that.

1 Answers

What about having two setup types – "Full installation" and "Portable mode"? And allowing the icons tasks for the "Full installation" type only?

For Uninstallable, use WizardIsComponentSelected.

[Setup]
Uninstallable=WizardIsComponentSelected('full')

[Types]
Name: "full"; Description: "Full installation"
Name: "portable"; Description: "Portable mode"

[Components]
Name: "full"; Description: "full"; Types: full

[Tasks]
Name: "desktopicon"; Description: "Create a Desktop shortcut"; Components: full
Name: "startmenu"; Description: "Create a Start Menu entry"; Components: full

enter image description here

Related