home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Examples / StartMenu / Example.nsi
Encoding:
Text File  |  2007-12-01  |  1.2 KB  |  50 lines

  1. Name "StartMenu.dll test"
  2.  
  3. OutFile "StartMenu Test.exe"
  4.  
  5. XPStyle on
  6.  
  7. Page directory
  8. DirText "This installer will create some shortcuts to MakeNSIS in the start menu.$\nFor this it needs NSIS's path." \
  9.   "Please specify the path in which you have installed NSIS:"
  10. InstallDir "${NSISDIR}"
  11. Function .onVerifyInstDir
  12.     IfFileExists $INSTDIR\makensis.exe +2
  13.         Abort
  14. FunctionEnd
  15.  
  16. Page custom StartMenuGroupSelect "" ": Start Menu Folder"
  17. Function StartMenuGroupSelect
  18.     Push $R1
  19.  
  20.     StartMenu::Select /checknoshortcuts "Don't create a start menu folder" /autoadd /lastused $R0 "StartMenu.dll test"
  21.     Pop $R1
  22.  
  23.     StrCmp $R1 "success" success
  24.     StrCmp $R1 "cancel" done
  25.         ; error
  26.         MessageBox MB_OK $R1
  27.         StrCpy $R0 "StartMenu.dll test" # use default
  28.         Return
  29.     success:
  30.     Pop $R0
  31.  
  32.     done:
  33.     Pop $R1
  34. FunctionEnd
  35.  
  36. Page instfiles
  37. Section
  38.     # this part is only necessary if you used /checknoshortcuts
  39.     StrCpy $R1 $R0 1
  40.     StrCmp $R1 ">" skip
  41.  
  42.         CreateDirectory $SMPROGRAMS\$R0
  43.         CreateShortCut $SMPROGRAMS\$R0\MakeNSISw.lnk $INSTDIR\makensisw.exe
  44.  
  45.         SetShellVarContext All
  46.         CreateDirectory $SMPROGRAMS\$R0
  47.         CreateShortCut "$SMPROGRAMS\$R0\All users MakeNSISw.lnk" $INSTDIR\makensisw.exe
  48.  
  49.     skip:
  50. SectionEnd