inno-setupshortcut-file

Make a selection which desktop shortcut icons to create in Inno Setup


I want to make a section in my Inno Setup where the user can choose which desktop shortcuts to create. Because I plan to have 4 shortcuts, but they are not all required to work. I want a user to choose the desktop shortcuts that will be created. Here is my current script:

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
    GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: "C:\Users\hwkru\Documents\WinUEFI\{#MyAppExeName}"; \
    DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\hwkru\Documents\WinUEFI\WinUEFI-console.exe"; \
    DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\hwkru\Documents\WinUEFI\WinUEFI-x86.exe"; \
    DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\hwkru\Documents\WinUEFI\WinUEFI-x86-console.exe"; \
    DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{autodesktop}\{#MyAppName}"; \
    Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{autodesktop}\WinUEFI Console"; \
    Filename: "{app}\WinUEFI-console.exe"; Tasks: desktopicon
Name: "{autodesktop}\WinUEFI (32-bit)"; \
    Filename: "{app}\WinUEFI-x86.exe"; Tasks: desktopicon
Name: "{autodesktop}\WinUEFI (32-bit) Console"; \
    Filename: "{app}\WinUEFI-x86-console.exe"; Tasks: desktopicon

Then people would not require to create all of these 4 shortcuts, as there is a 32 and 64 bit version.


Solution

  • Create separate task for each of your shortcuts, instead of the one desktopicon task:

    [Tasks]
    Name: "appdesktopicon"; Description: "Application icon"; \
        GroupDescription: "{cm:AdditionalIcons}"
    Name: "ueficondesktopicon"; Description: "WinUEFI Console icon"; \
        GroupDescription: "{cm:AdditionalIcons}"
    Name: "uefi32desktopicon"; Description: "WinUEFI (32-bit) icon"; \
        GroupDescription: "{cm:AdditionalIcons}"
    Name: "uefi32condesktopicon"; Description: "WinUEFI (32-bit) Console icon"; \
        GroupDescription: "{cm:AdditionalIcons}"
    
    [Icons]
    Name: "{autodesktop}\{#MyAppName}"; \
        Filename: "{app}\{#MyAppExeName}"; Tasks: appdesktopicon
    Name: "{autodesktop}\WinUEFI Console"; \
        Filename: "{app}\WinUEFI-console.exe"; Tasks: ueficondesktopicon
    Name: "{autodesktop}\WinUEFI (32-bit)"; \
        Filename: "{app}\WinUEFI-x86.exe"; Tasks: uefi32desktopicon
    Name: "{autodesktop}\WinUEFI (32-bit) Console"; \
        Filename: "{app}\WinUEFI-x86-console.exe"; Tasks: uefi32condesktopicon
    

    enter image description here