Skip to content
⌘ NSIS Forum Archive

Help please ;-)

3 posts

dabossuk#

Help please ;-)

Hi

its almost 2am and time for bed, and finally got the last of my bugs out ;-) However I am stuck on the following things :

1. Auto Uninstall

If I run the setup I check to see if my app is already installed, if it is I want to uninstall it before installing again. Right now it pops up a messagebox telling the user to manually uninstall the app. Is there a clean, simple way of automatically uninstalling before installing - or do I just need to copy / paste the uninstall section into a function and just call that ? or is it best to let the user deal with it ?

2. Is there a way to add an uninstall item to the add/remove ? I have tried the sample in the archive but it does not work. Ie

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\program" "MyApp" "$INSTDIR\Uninstall.exe"

"program" = is what is in the sample - should this be the name of my app ?

3. Finally a dumb question! ;-)

I under stand Push and Pop - and I am using them. However I am also using Exch and have just copy / pasted out of other samples - but really do not understand what it does. For example, the checking for .NET sample of the archive uses it - but if I comment out it makes no difference ... could someone explain to me in idiot language.

Thanks for any advice, I am using NSIS 2B3

Thanks

Dabossuk
Joel#
I try to help you
1. Before to
File "myfile.chm" 
where's start to copy the file use the istruction "IfFileExists"
Read the example: ${NSISDIR}\NSIS\Examples\makensis.nsi

2.This might help you

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT} - Uninstall"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\Uninstaller.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayIcon" "$INSTDIR\Uninstaller.exe,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "Publisher" "From Me"
3. Push almost like "Read" Pop almost like "Write", I think 🧟
[edit] Read this doc [/edit]

PS:
program=${MUI_PRODUCT}

helps
deguix#edited
1) Use:

SetOverwrite ifnewer
;Use file commands here!
SetOverwrite on 
This is the most recommended way to install. Because if is a update, will update only new files.

2) See at Apendix C in documentation. Example of use:

WriteRegStr HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Product" "DisplayName" "Application Name" 
3) Exch - Exchanges two elements - if you put a variable parameter - will exchange the top of the stack with the variable:

;STACK Top: Something
StrCpy $0 "None"
Exch $0
MessageBox MB_OK $0 ;Will show here "Something"
;STACK Top: None 
If you put a number parameter - will exchange the top of the stack with the element in this position (starting in 2nd top of stack):

;STACK Top: Something, 2nd: None, 3rd: Object
Exch 2
;STACK Top: Object, 2nd: None, 3rd: Something 
If you do not put a parameter - will exchange between two top stack elements.

;STACK Top: Something, 2nd: None
Exch
;STACK Top: None, 2nd: Something