Archive: Hide the MUI_PAGE_STARTMENU page


Hide the MUI_PAGE_STARTMENU page
Hi,

I juste begin with NSIS.

I have in my script an optional section named 'secStartMenuShortcuts' which creates the shortcuts for my application.

I also have enabled the Start menu page (!define MUI_STARTMENUPAGE_NODISABLE)

The problem is that I would like to show the StartMenu page only if the startmenu section has been enabled by the user.

Does anyone know how to do it?

Thanks,
Fabio Chelly


Define a pre function (MUI_PAGE_CUSTOMFUNCTION_PRE) and call Abort if the section is selected (SectionGetFlags or !include Sections.nsh, !insertmacro SectionFlagIsSet).


Thank you for the answer.
The problem is that I don't know how to define a pre function with the modern UI.
My call is like this:
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP

Where do I define a pre function for this page?


Right above the macro.

!define MUI_PAGE_CUSTOMFUNCTION_PRE pre
!insertmacro MUI_PAGE_STARTMENU "start menu page id"


I get the following error:

Error: resolving install function "pre" in function "mui.StartmenuPre_58.5.12"
Note: uninstall functions must begin with "un.", and install functions must not
Here is my code:

Function MUI_PAGE_CUSTOMFUNCTION_PRE
MessageBox MB_YESNO "Do you want to skip the startmenu page?" IDNO no
Abort
no:
FunctionEnd


!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY

!define MUI_PAGE_CUSTOMFUNCTION_PRE pre
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

MUI_PAGE_CUSTOMFUNCTION_PRE is the name of the define, not the function. The value of the define should the name of the function. Simply change the function's name to 'pre' in the above example.


Thank you very much. The pre function works perfectly now.
But now I have a problem with SectionFlasgIsSet: the following code doesn't work.

  Function SkipStartMenu
!insertmacro SectionFlagIsSet SecShortcutStartMenu ${SF_SELECTED} IsSel IsNotSel
IsNotSel:
Abort
IsSel:
FunctionEnd
Maybe it doesn't work because 'SecShortcuts' is a section included in a parent section 'SecShortcuts'?

That's OK. In fact I didn't put the function AFTER my section definition.


hi!

i've solved the same problem yesterday, with the attached function. parts of it are from another thread right in this forum.

here's the code:

Var SMP

!define MUI_PAGE_CUSTOMFUNCTION_PRE Startmenu
!insertmacro MUI_PAGE_STARTMENU smid $SMP

Section $(sec_startmenu) s_s
...
SectionEnd

Function Startmenu
StrCpy $R1 "1"
SectionGetFlags ${s_s} $R0
IntOp $R0 $R0 & $R1
StrCmp $R0 $R1 +2 0
Abort
FunctionEnd


it works great.