Old 4th December 2021, 12:43   #1
MB1
Junior Member
 
Join Date: Dec 2021
Posts: 1
Uninstall Start menu shortcut

Hi
Env Win 7 Nsis 3.08
I'm new about nsis.. i just succesfully create some simple NSIS scrpt to install my programs
The question is about start menu shortcut unistalling
i succesfully write code to let to installer to choose start menu folder
i put here the interested code

code:
XPStyle on
Page custom StartMenuGroupSelect "" ": Start Menu Folder"
UninstPage uninstConfirm
UninstPage instfiles

Function StartMenuGroupSelect
Push $R1

StartMenu::Select /checknoshortcuts "Don't create a start menu folder" /autoadd /lastused $R0 "MP3 Downloader"
Pop $R1

StrCmp $R1 "success" success
StrCmp $R1 "cancel" done
; error
MessageBox MB_OK $R1
StrCpy $R0 "MP3 Downloader" # use default
Return
success:
Pop $R0

done:
Pop $R1
FunctionEnd
Section "Start Menu Shortcuts"
# this part is only necessary if you used /checknoshortcuts
StrCpy $R1 $R0 1
StrCmp $R1 ">" skip

CreateDirectory $SMPROGRAMS\$R0
CreateShortcut $SMPROGRAMS\$R0\MP3_Dowmloader.lnk $INSTDIR\MP3_Downloader.bat
CreateShortcut "$SMPROGRAMS\$R0\MP3 Updater.lnk" "$INSTDIR\Updater.bat"

skip:
SectionEnd



the question is how to reference the directory $SMPROGRAMS\$R0
in the unistallal section ?

i tried

code:
Delete "$SMPROGRAMS\$R0\MP3_Dowmloader.lnk"
Delete "$SMPROGRAMS\$R0\MP3 Updater.lnk"
RMDir "$SMPROGRAMS\$R0"



but it does not function ..
i'm not using the modern interface..and if possible i do not want to use it..
Thanks in advance for the support
MB1 is offline   Reply With Quote
Old 4th December 2021, 15:24   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,457
Classic NSIS does not write anything anywhere automatically, you need to save the folder name in the installer. You can save it in a .ini file or in the registry. Restore the variable in your uninstaller.

Ideally you should just have a single shortcut in $SMPROGRAMS. The Microsoft guidelines say you should not create shortcuts to updaters/uninstallers/help etc.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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