Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Add a Desktop Shortcut Option on Finish Page in NSIS installer?

Tags:

I'm trying to create an installer using NSIS Modern User Interface for the first time. I would like to know how I can add an option (checkbox) for users to select to have a desktop shortcut created on the Finish Page (the last screen of the installer) in addition to the "Run XXXX" option that's already there.

like image 236
takoloco Avatar asked Oct 04 '09 21:10

takoloco


People also ask

How do I create an installer shortcut?

Right-click on .exe file and choose to create a shortcut; Go to properties of the shortcut and select an icon and choose a meaningful name; Add the shortcut on User's Desktop and User's Programs Menu.

How do I add a Softoeare shortcut to my desktop?

Click the Windows key, and then browse to the Office program for which you want to create a desktop shortcut. Right-click the program name or tile, and then select Open file location. Right-click the program name, and then click Send To > Desktop (Create shortcut). A shortcut for the program appears on your desktop.

How do you compile NSIS?

NSIS installers are generated by using the 'MakeNSIS' program to compile a NSIS script (. NSI) into an installer executable. The NSIS development kit installer sets up your computer so that you can compile a . nsi file by simply right-clicking on it in Explorer and selecting 'compile'.


2 Answers

If you are not using readme checkbox on the finish page, you can use it to perform whatever action you want:

Function finishpageaction CreateShortcut "$desktop\foo.lnk" "$instdir\foo.exe" FunctionEnd  !define MUI_FINISHPAGE_SHOWREADME "" !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED !define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut" !define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction 
like image 165
Anders Avatar answered Oct 06 '22 14:10

Anders


An alternate, and the simplest way to allow the user to add a desktop icon is to create a custom Section that does it. The user can then choose to add the shortcut in the "features" page of the installer and you don't have to do heavy modifications of the UI.

Section "Desktop Shortcut" SectionX     SetShellVarContext current     CreateShortCut "$DESKTOP\Your Program.lnk" "$INSTDIR\YourProgram.exe" SectionEnd 
like image 43
Julien Lebosquain Avatar answered Oct 06 '22 15:10

Julien Lebosquain