Old 15th September 2011, 17:04   #1
thek
Member
 
thek's Avatar
 
Join Date: Jun 2006
Location: Austria
Posts: 92
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
code:
!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

thek is offline   Reply With Quote
Old 15th September 2011, 20:08   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,927
Use this workaround:

Quote:
Function SMPageLeave

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

FunctionEnd

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 16th September 2011, 07:19   #3
thek
Member
 
thek's Avatar
 
Join Date: Jun 2006
Location: Austria
Posts: 92
Thanks that works fine!

I found another solution, but yours is "nicer"
thek is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
mui2, start menu

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump