Archive: Optional Desktop Icon


Optional Desktop Icon
  Hi everyone , iam using the modern UI style that comes with NSIS to produce an installer. Does anybody know if theres a macro that comes with this style that will put a dialogue in my installer that will ask the user if they wish to place a shortcut icon onto the desktop?

Thanks Mike


No, but you can create one....or....simple add a section given the user to choose or not.


I was pretty sure this was the case after I scanned through system.nsh and looked at some of the macros. Is it quite easy to make your own screens with macros, or will I need to do some advanced tutorials?!


I would put that into the SECTION part like this example from my scripts:

SubSection/e "Verknüpfungen für aktuellen Benutzer" SecInfo30

Section"Startmenügruppe" SecInfo31
SectionEnd

Section/o "Verknüpfung auf dem Desktop" SecInfo32
SectionEnd

Section/o "Verknüpfung im Schnellstartmenü" SecInfo33
SectionEnd
SubSectionEnd

SubSection"Verknüpfungen für alle Benutzer" SecInfo40
Section/o "Startmenügruppe" SecInfo41
SectionEnd

Section/o "Verknüpfung auf dem Desktop" SecInfo42
SectionEnd

Section/o "Verknüpfung im Schnellstartmenü" SecInfo43
SectionEnd
SubSectionEnd
>
in english
- startmenu
- desktop
- quickstart


and here the part for read out options
(define goes in header of script)

  !define SF_SELFLAG "65" 

 ;get section 30 flags (1 or 64)

SectionGetFlags ${SecInfo30} $R9
IntOp $R9 $R9& ${SF_SELFLAG}

;
get section 40 flags (1 or 64)
SectionGetFlags ${SecInfo40} $R9
IntOp $R9 $R9& ${SF_SELFLAG}

  ;get user options from sections - current

IntCmp $SECTION30"0" setlinks06
;current user selected
SectionGetFlags${SecInfo31} $R9
IntOp $START_MENU $R9& ${SF_SELECTED}
SectionGetFlags ${SecInfo32} $R9
IntOp $DESK_TOP $R9& ${SF_SELECTED}
SectionGetFlags ${SecInfo33} $R9
IntOp $QUICK_LAUNCH $R9& ${SF_SELECTED}
;
create shortcuts for current users
SetShellVarContext current
Goto setlinks07

setlinks06:
;get user options from sections - alluser
IntCmp $SECTION30"0" setlinks07
;all users selected
SectionGetFlags${SecInfo41} $R9
IntOp $START_MENU $R9& ${SF_SELECTED}
SectionGetFlags ${SecInfo42} $R9
IntOp $DESK_TOP $R9& ${SF_SELECTED}
SectionGetFlags ${SecInfo43} $R9
IntOp $QUICK_LAUNCH $R9& ${SF_SELECTED}
;create shortcuts for all users
SetShellVarContext all
;Goto setlinks06

setlinks07:
;create startmenu
>
variables are related to section names