Old 30th November 2010, 10:24   #1
Junior Member
Join Date: Oct 2010
Posts: 17
Read dynamically uninstall Name

I'm reading on startup .onInit the $my_name variable and
Name $pdName
This works great for my installer but what if I want to use it for the uninstaller
Can you tell me how exactly NSIS is generating variables for the uninstaller. Is there some way to store them on WriteUninstaller
bostko is offline   Reply With Quote
Old 30th November 2010, 15:24   #2
Major Dude
T.Slappy's Avatar
Join Date: Jan 2006
Location: Slovakia
Posts: 552
Send a message via ICQ to T.Slappy
Do you mean the OutFile ???

Because there is a difference between Name and OutFile.
Name - it is just a description of installer, just some string
where the OutFile is name of the .exe file written to disk
WriteInstaller has nothing with them - it is a name of .exe file written to disk which is used to uninstall your application - you can name if freely

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 30th November 2010, 16:24   #3
Junior Member
Join Date: Oct 2010
Posts: 17
All I'm saying is that it is easy to declare in the nsi head
Name My Program
but when it is
Name $varSetOnInit
It has to be variable which is set .onInit or respectively in un.onInit
Is there any chance to store its value on this row
WriteUninstaller $INSTDIR\uninstaller.exe not on compile time
bostko is offline   Reply With Quote
Old 30th November 2010, 18:07   #4
Junior Member
Join Date: Aug 2010
Posts: 29
This may not be what you are looking for but you can store the value in the registry. For example, in one of my installers I have the "-Post" section write values out to the registry. You could also do this just before, or after, you execute the write uninstaller command. Here's an example from my "-Post" section:

WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"

You can then simply read this variable in the uninstaller by using ReadRegStr and either store it in a variable you created or simply store it in a stack variable and use it:

ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"

Now do a StrCmp on $0 to "" or do ${IF} $0 != "". You may also want to check the error flag (see the documentation on ReadRegStr about what the error flag will be set to). Hope this helps.
blh83 is offline   Reply With Quote
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