Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   delete setup.exe as last action? (http://forums.winamp.com/showthread.php?t=265448)

xirisone 9th February 2007 08:11

delete setup.exe as last action?
 
Hi,

I need to delete my NSIS 'setup.exe' as last step of the setup itself. I can not use a BAT-file which calls setup.exe first and then deletes the file.

Can a NSIS setup delete it's own setup.exe as last action?

TIA,
xirisone

Takhir 9th February 2007 08:16

http://forums.winamp.com/showthread....hlight=selfdel

xirisone 9th February 2007 09:11

do I have to replace 'SelfDel' with the name of my MySetup.exe in your example.nsi?

!define APP_NAME SelfDel # old
!define APP_NAME MySetup # new

TIA,
xirisone (newbie)

xirisone 9th February 2007 10:00

1 Attachment(s)
@Takhir
got you dll working - nearly....
Problem: link and folder 'unsd' are not deleted.
My script attached. Did I include the code from your example.nsi wrongly?

TIA,
xirisone

Takhir 9th February 2007 10:14

Included sample removes uninstaller, if you want to remove setup.exe use following code
code:

Function .onGUIEnd
SelfDel::del
FunctionEnd

but please note that in the silent mode this may not work (no function call in NSIS). The same line at the end of last mandatory section should work always, but cursor on the finish page will be with 'waiting'.

xirisone 9th February 2007 11:03

@Takhir
removing the setup.exe works fine with you example, the link and the folder 'unsd' are not deleted. Could you check my test.nsi? That would be VERY nice.
TIA,
xirisone

Takhir 9th February 2007 11:23

I guess you don't need to create links at all. The sample included to SelfDel.zip describes the most complex situation - uninstaller deletion inplace. To simulate uninstall it creates subdir, writes uninstaller and creates link (simulating start menu). You don't need this, just add the only line from my post above after # prepare automatic delete of Installer....
BTW I re-tested included to zip sample and it worked as requested.
Uninstaller auto deletes itself, this not require a plug-in.

xirisone 9th February 2007 12:00

@Takhir
You're right!!!! Just using:

Function .onGUIEnd
SelfDel::del
FunctionEnd

does the job.
Thank you VERY much!

xirisone

Red Wine 9th February 2007 20:19

Quote:

Originally posted by xirisone
@Takhir
You're right!!!! Just using:

Function .onGUIEnd
SelfDel::del
FunctionEnd

does the job.
Thank you VERY much!

xirisone

What about if users for some reason decided to install the application later and click cancel e.g. on license page or components page or every included page?
It deletes the installer and nothing is installed.
Compile the following example and hit cancel on some page.

Not the best behaviour if I've downloaded a large (e.g. 100 mb) installer on a slow internet connection and I have to download again and perhaps I'll get again the same strange result.

Perhaps you should add a messagebox informing users not to click cancel otherwise they have to re-download the installer.
code:
!define APP_NAME SelfDel

Name "${APP_NAME}"
OutFile "${APP_NAME}.exe"
InstallDir "$PROGRAMFILES\${APP_NAME}"

Page Components
Page Directory
Page InstFiles

Section "Dummy Section"

SetOutPath "$INSTDIR"

SectionEnd


Function .onGUIEnd

SelfDel::del

FunctionEnd


Takhir 10th February 2007 08:24

Just to keep xirisone informed: SelfDel plug-in page

Red Wine 10th February 2007 09:42

@ Takhir,
probably you need to update the above provided link, currently it is a link to page that doesn't exist.

Takhir 10th February 2007 09:48

Thanks, Red Wine. Updated.


All times are GMT. The time now is 04:45.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.