Archive: MUI 2 setting of variable for MUI_PAGE_STARTMENU


MUI 2 setting of variable for MUI_PAGE_STARTMENU
Hello
I'm using MUI2 for my installer
I would like to check if the user selects a already existing Start menu folder and If so, I want to abort the installation or force the user to select another
(reason, the old version of our tool used another installer)

The problem: the Variable $Startmenufolder is not initialized in the "OnLeave" function
what can I do get the selected folder?
samplecode

!define MUI_PAGE_CUSTOMFUNCTION_PRE "Show_hide_page"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW "change_header_text_to_white"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\YY\XX_${SHORT_VERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "check_if_XX_Installed_Startmenu"
!insertmacro MUI_PAGE_STARTMENU "the_Startmenu" $StartMenuFolder

...
Function check_if_XX_Installed_Startmenu
MessageBox MB_OK "$StartMenuFolder" ;
${if} ${FileExists} "$SMPROGRAMS\$StartMenuFolder"
MessageBox MB_OK|MB_ICONEXCLAMATION "XX is already installed in the Startmenu folder '$StartMenuFolder'.$\r$\nPlease select another folder or uninstall the old Version first."
Abort
${Endif}
FunctionEnd

Use this workaround:

Function SMPageLeave

${NSD_GetText} $mui.StartMenuPage.Location $0
MessageBox mb_ok $0

FunctionEnd

Thanks that works fine!

I found another solution, but yours is "nicer"