Skip to content
⌘ NSIS Forum Archive

Start menu entries not created

3 posts

2biased#

Start menu entries not created

Hi,

by reading through the forum and the docs the Start Menu entry topic should be a easy thing but unfortunately I am not able to make it work for me. I try to create 3 sub folders in the start menu like

$SMPROGRAMS\A Folder\B Folder\C Folder

and within the C Folder 4 items

StartApp -> goes to the exe
ShowReadme -> points to a text file
OpenManual -> points to a pdf file
Uninstall -> points to the uninstaller

The code for this looks like the following:


Section "ToStartMenu"

; Install for all users if uncommented
; SetShellVarContext current

IfFileExists "$SMPROGRAMS\A Folder\*.*" +2 0
CreateDirectory "$SMPROGRAMS\A Folder"
IfFileExists "$SMPROGRAMS\A Folder\B Folder\*.*" +2 0
CreateDirectory "$SMPROGRAMS\A Folder\B Folder"
IfFileExists "$SMPROGRAMS\A Folder\B Folder\C Folder\*.*" +2 0
CreateDirectory "$SMPROGRAMS\A Folder\B Folder\C Folder"
CreateShortCut "$SMPROGRAMS\A Folder\B Folder\C Folder\StartApp.lnk" "$INSTDIR\StartApp.exe"
CreateShortCut "$SMPROGRAMS\A Folder\B Folder\C Folder\ReadMe.lnk" "$INSTDIR\TheRealReadme.txt"
CreateShortCut "$SMPROGRAMS\$SMPROGRAMS\A Folder\B Folder\C Folder\Manual.lnk" "$INSTDIR\User Manual.pdf"
CreateShortCut "$SMPROGRAMS\A Folder\B Folder\C Folder\Uninstall.lnk" "$INSTDIR\Uninst.exe"

; back to current user if uncommented
; SetShellVarContext current

SectionEnd
The folders are created without problems but the installer claims to have problems to create the actual shortcuts. No matter if I try to install them into the user space or for all user using the SetShellVarContext commented out in this example.

As I said, I didn't find a solution to the problem in the manual or the forum and I am pretty new to NSIS so I hope someone can give me a small hint what I do wrong.

Thanks in advance.
kichik#
There's no need for all of those IfFileExists calls. CreateDirectory will create the directory and any missing parent directories and will simply continue if the directory already exists.

I can't tell why the shortcuts are not being created from the example you gave, aside from that double $SMPROGRAMS typo. Make sure you're using the exact same path for CreateDirectory and CreateShortcut. If that doesn't work, attach a real example.
2biased#
Thanks for the hint with the typo. In the actual code it wasn't this typo but I had an error with the paths I just didn't see. Sorry for the hassle thought but thanks a lot for the help. Really apreciate it.