Old 9th February 2007, 08:11   #1
xirisone
Junior Member
 
Join Date: Feb 2007
Posts: 19
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
xirisone is offline   Reply With Quote
Old 9th February 2007, 08:16   #2
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
http://forums.winamp.com/showthread....hlight=selfdel
Takhir is offline   Reply With Quote
Old 9th February 2007, 09:11   #3
xirisone
Junior Member
 
Join Date: Feb 2007
Posts: 19
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 is offline   Reply With Quote
Old 9th February 2007, 10:00   #4
xirisone
Junior Member
 
Join Date: Feb 2007
Posts: 19
@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
Attached Files
File Type: nsi test.nsi (1.6 KB, 279 views)
xirisone is offline   Reply With Quote
Old 9th February 2007, 10:14   #5
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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'.
Takhir is offline   Reply With Quote
Old 9th February 2007, 11:03   #6
xirisone
Junior Member
 
Join Date: Feb 2007
Posts: 19
@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
xirisone is offline   Reply With Quote
Old 9th February 2007, 11:23   #7
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Takhir is offline   Reply With Quote
Old 9th February 2007, 12:00   #8
xirisone
Junior Member
 
Join Date: Feb 2007
Posts: 19
@Takhir
You're right!!!! Just using:

Function .onGUIEnd
SelfDel::del
FunctionEnd

does the job.
Thank you VERY much!

xirisone
xirisone is offline   Reply With Quote
Old 9th February 2007, 20:19   #9
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 10th February 2007, 08:24   #10
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Just to keep xirisone informed: SelfDel plug-in page

Last edited by Takhir; 10th February 2007 at 09:47.
Takhir is offline   Reply With Quote
Old 10th February 2007, 09:42   #11
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
@ Takhir,
probably you need to update the above provided link, currently it is a link to page that doesn't exist.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 10th February 2007, 09:48   #12
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Thanks, Red Wine. Updated.
Takhir 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