Archive: Start Menu Uninstall Question


Start Menu Uninstall Question
Hello Everyone,

I am creating an installer that is very basic, just copying files. I am using multiple sections, and multiple start menu folders.

I am having trouble having the uninstaller remove any of the start menu sub folders. All of the links get deleted, as well as the files, but the sub-folders in the start menu remain.

Here are c&p from the nsi:

;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER\Title Block"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Title Block\PartDiagnoseProgram.lnk" "$INSTDIR\Title Block\PartDiagnoseProgram.ppt"
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER\Part Diagnose"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Part Diagnose\PartDiagnose.lnk" "$INSTDIR\Excel Notes\PartDiagnose.zip"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"

*****************************
I have tried 2 different ways to get the sub-folders in the start menu to delete
*****************************
1st try:
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
2nd try:
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP\Part Diagnose"
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP\Excel Notes"
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP\Title Block"
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"

startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."

IfErrors startMenuDeleteLoopDone

StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:


What am I missing? - Thanks for your time!


You first attempt should work, assuming the start menu folder is in $MUI_TEMP. That requires you've used something like the following right above that code:

!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
If you haven't used it, or have used something else rather than $MUI_TEMP, $MUI_TEMP will not contains the correct folder. You can use MessageBox to display the current value of $MUI_TEMP to make sure it's correct.

Originally posted by kichik
You first attempt should work, assuming the start menu folder is in $MUI_TEMP. That requires you've used something like the following right above that code:
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
If you haven't used it, or have used something else rather than $MUI_TEMP, $MUI_TEMP will not contains the correct folder. You can use MessageBox to display the current value of $MUI_TEMP to make sure it's correct.
kichik,

I have the line:
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

How do I use messagebox to determine current value of $MUI_TEMP?

Thanks!

Hello Everyone,

Answering my own post again based another thread that caught my eye.

I used:

RMDir /r $MUI_TEMP
to solve the problem.

Thanks!