Old 21st November 2005, 13:39   #1
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
Question Removing Renamed Desktop Shortcuts

Hi,

OK, I need to write an installer that detects/removes a previous version of an application and its desktop shortcut and then installs the updated version and recreates the shortcut. The previous version was not installed by NSIS.

The problem that I'm having right now is that users often rename the desktop shortcut for the app, making script-based removal procedures more complicated.

Anyone have any suggestions for how to tackle this? I need to be able to detect/remove any and all desktop shortcuts for this app regardless of what the user has renamed it to....


Thanks
ewallig is offline   Reply With Quote
Old 21st November 2005, 14:13   #2
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Script to delete shortcuts by target file name from $DESKTOP, $QUICKLAUNCH, $SMPROGRAMS. You can easily change it to delete by working directory and so on. Script used Locate plugin and ShellLink plugin
code:
Name "Output"
OutFile "Output.exe"

!include "FileFunc.nsh"
!insertmacro GetFileName

Section
StrCpy $0 "SmashChat.exe" #File name of the application

locate::Open /NOUNLOAD "$DESKTOP" "/F=1 /D=0 /M=*.lnk /P=$QUICKLAUNCH|$SMPROGRAMS /B=1" .r1
StrCmp $1 -1 0 locatenext
MessageBox MB_OK "Error" IDOK endfind

locatenext:
locate::Find /NOUNLOAD .r1 .r2 .r3 .r4 .r5 .r6

StrCmp $1 '' endfind
ShellLink::GetShortCutTarget $1
Pop $7
${GetFileName} "$7" $7

StrCmp $7 $0 0 locatenext
Delete $1
goto locatenext

endfind:
locate::Close
SectionEnd

Instructor is offline   Reply With Quote
Old 21st November 2005, 14:15   #3
ewallig
Junior Member
 
Join Date: Sep 2005
Posts: 27
Thanks, I'll play around w/ that
ewallig 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