Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Delete shortcuts in start menu (http://forums.winamp.com/showthread.php?t=229847)

Cherry17 31st October 2005 22:03

Delete shortcuts in start menu
 
Hello,

I have got a problem with deleting the shortcuts in the start menu while uninstalling the program. I have read the posts in the forum but I did not find a solution.

I write the shortcuts with:

Var /GLOBAL test

StrCpy $R1 $R0 1
StrCpy $test $R0
StrCmp $R1 ">" skip

SetShellVarContext all
CreateDirectory $SMPROGRAMS\$R0
CreateShortCut $SMPROGRAMS\$R0\Analyzer.lnk $INSTDIR\Analyzer.exe
CreateShortCut $SMPROGRAMS\$R0\Uninstaller.lnk $INSTDIR\Uninstaller.exe

skip:

I want to delete them with:

Delete "$SMPROGRAMS\$test\*.*"
RMDir "$SMPROGRAMS\$test"

It does not work.

If I use

Delete "$SMPROGRAMS\Analyzer 1.0\*.*"
RMDir "$SMPROGRAMS\Analyzer 1.0"

it works. But I will not know the folder the user will choose so my second solution is not great. What's wrong with the first solution?

Thank,
Cherry17

Afrow UK 1st November 2005 06:52

You need to use the /r switch on RMDir:

RMDir /r "$SMPROGRAMS\$test"

Without it, RMDir will only delete a folder if it is empty.

-Stu

Cherry17 1st November 2005 09:19

Hi Afrow,

therefore I use Delete "$SMPROGRAMS\Analyzer 1.0\*.*" It should clear the directory. I don't want to use RMDir /r because I'am afraid of killing the whole start menu if I make a mistake with the path.

I want to delete the content of the folder.
I've just tried
Delete "$SMPROGRAMS\$test\Analyzer.lnk"
Delete "$SMPROGRAMS\$test\Uninstaller.lnk"
RMDir "$SMPROGRAMS\$test"
but it doesn't work.

Thanks,
Cherry17

Afrow UK 1st November 2005 17:14

Are there any hidden files in the folder (e.g. desktop.ini)

-Stu

Instructor 1st November 2005 17:20

Quote:

I want to delete them with:

Delete "$SMPROGRAMS\$test\*.*"
RMDir "$SMPROGRAMS\$test"

It does not work.

If I use

Delete "$SMPROGRAMS\Analyzer 1.0\*.*"
RMDir "$SMPROGRAMS\Analyzer 1.0"

it works.
Logically, $test variable does not contain correct value. When you run unistaller all variables is empty, so when installing you need to save variable $R0 suppose in registry, and when run unistaller read this value from registry to $temp.

Cherry17 2nd November 2005 08:09

Hi Instructor,

but I can remove the whole program. Only the shortcuts are the problem. Why can I remove the program? I thought the real values were written in the uninstaller but not the registers.
Is it wrong?

Thanks,
Kirstin

Instructor 2nd November 2005 09:15

When you runs unistaller it by default sets $INSTDIR=$EXEDIR

Cherry17 2nd November 2005 14:44

Hi Instructor,

ok. Now I can understand the problem. I don't want to write anything in the registry. I'am afraid of deleting something really important when I try to delete my entries. I will think it over.

Thanks for your help.
Kirstin

Afrow UK 2nd November 2005 14:50

Surely your startup path won't change so why should you need to store the path if it's a fixed path?
If you're scared of deleting a folder that isn't there... well you can't!

-Stu

Cherry17 3rd November 2005 08:36

Hi Afrow,

I create a folder in the startup menu. I think I have to save the name of this folder, don't I?
The user can change the name of this folder while installing the program. If he uses the default name, I will be able to remove the folder, but if he changes the name, I will not.

Thanks,
Kirstin

Cherry17 3rd November 2005 09:01

HiAfrow,

an ini-file is a great solution! I will try it.

Thank,
Kirstin

Afrow UK 3rd November 2005 09:02

In that case there is no other way but storing the folder name in the registry or in an INI file.

-Stu

Afrow UK 3rd November 2005 09:15

Strange how that happens sometimes. You posted after me but the post has gone above mine in the list.

Anyway, use WriteINIStr and ReadINIStr.

-Stu


All times are GMT. The time now is 05:12.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.