Old 31st May 2002, 20:18   #1
mickmo
Junior Member
 
Join Date: May 2002
Posts: 2
Remove OutFile

Hello, I was told by my boss to learn NSIS and use it for the program I created. I finally figured out how to use it thanks to the documentation and this discussion site. However, there is one thing I would like to do in NSIS and haven't been able to fiqure out. Is it possible to delete the Outfile after the user installs the program?
I have tried to use delete command and I even hard coded the path and nothing seemed to work. Is it possible to delete this file through code? If it is how?

Thank you.
mickmo is offline   Reply With Quote
Old 1st June 2002, 07:41   #2
Smile2Me
Guest
 
Posts: n/a
Read this.

If you also want a proper uninstall, do something like this
code:
name deleter
outfile deleter.exe

SilentInstall silent

section
Sleep 500
Call GetParameters
Pop $0
Delete $0
sectionend

Function GetParameters
Push $0
Push $1
Push $2
StrCpy $0 $CMDLINE 1
StrCpy $1 '"'
StrCpy $2 1
StrCmp $0 '"' loop
StrCpy $1 ' ' ; we're scanning for a space instead of a quote
loop:
StrCpy $0 $CMDLINE 1 $2
StrCmp $0 $1 loop2
StrCmp $0 "" loop2
IntOp $2 $2 + 1
Goto loop
loop2:
IntOp $2 $2 + 1
StrCpy $0 $CMDLINE 1 $2
StrCmp $0 " " loop2
StrCpy $0 $CMDLINE "" $2
Pop $2
Pop $1
Exch $0
FunctionEnd


That's the deleter. In the installer do something like this
code:
outfile prob.exe
name prob

section
sectionend

function .onInstSuccess
SetOutPath $TEMP
File /oname=_deleter.exe deleter.exe
Exec '$TEMP\_deleter.exe $EXEDIR\prob.exe'
functionend


The exe might have been renamed though...

-Hendri.
  Reply With Quote
Old 3rd June 2002, 14:55   #3
mickmo
Junior Member
 
Join Date: May 2002
Posts: 2
Thumbs up Thank you

Thank you for your help. It is much appreciated.
mickmo is offline   Reply With Quote
Old 3rd June 2002, 16:16   #4
Smile2Me
Guest
 
Posts: n/a
Good

Thx,
-Hendri.
  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