Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 11th June 2007, 21:03   #1
starsign
Junior Member
 
Join Date: Jun 2007
Posts: 5
run uninstaller if exec fails

Hi,

As part of my installation I call execwait to run a c# exe. If this fails the user is notified and I would like to run unnstall. I have tried calling ExecWait "$INSTDIR/uninst.exe", however this then asks the user if they want to cancel (needed for std uninstall), when I don't want to give the user a choice.

I would also like to do this if there is an error in the install generally. I clear errors at the start and can test if there are errors at the end, so I guess the calling of the uninstaller would be the same as the above?

Thanks.
starsign is offline   Reply With Quote
Old 11th June 2007, 21:12   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
1. It goes with the /S (silent) switch however ExecWait "$INSTDIR/uninst.exe" would not operate properly.
The method on how to call the uninstaller from the installer explained in the included example makensis.nsi, I'd suggest follow that method.

2. Normally would be the same, you have to try though.

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 11th June 2007, 21:52   #3
starsign
Junior Member
 
Join Date: Jun 2007
Posts: 5
Thanks for your comments. I have taken the example code you mentioned and now have the following code in the _Post section of my installer (this is where I run my .exe, as I need to know that the registry info has been set up...if there is a better place to have it then let me know):

I can't get the messageboxes to turn off by using the /S switch...I just create an error...how should I implement that?

Silent_Uninstall:
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SmartChart" "UninstallString"

;Run uninstaller
HideWindow

ClearErrors
ExecWait '$R1 _?=$INSTDIR'

IfErrors no_remove_uninstaller
;IfFileExists "$INSTDIR\SmartChart.exe" no_remove_uninstaller
Delete $R1
RMDir $INSTDIR

no_remove_uninstaller:
Quit


done:
SectionEnd
starsign is offline   Reply With Quote
Old 11th June 2007, 21:58   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
You'd need the /SD switch for the message boxes, refer to NSIS documentation about.

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
Reply
Go Back   Winamp 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