Skip to content
⌘ NSIS Forum Archive

Need help about some easy subjects

7 posts

Xi0Ns#

Need help about some easy subjects

First: thanks for all the people that makes this real:

I want to ask some things:

1: How do i do to set a custom folder in a shortcut's "Start in" field when i create such shortcut?

2: In the components page, i want to display "Create shortcuts" and enable to expand this and show under the same component, 2 child components "Start menu" and "Desktop"?? (that stuff with the "+" symbol beside the component).

Thanks for your help
Afrow UK#
1. Use SetOutPath first.
2. ...

SectionGroup "Create shortcuts" secGroupCSC

Section "Desktop" secSCDesktop
SetOutPath $INSTDIR
CreateShortCut "$DESKTOP\My App.lnk" "$INSTDIR\MyApp.exe"
SectionEnd

Section "Start menu" secSCStartMenu
SetOutPath $INSTDIR
CreateDirectory "$SMPROGRAMS\My App"
CreateShortCut "$SMPROGRAMS\My App\My App.lnk" "$INSTDIR\MyApp.exe"
SectionEnd

SectionGroupEnd
-Stu
Xi0Ns#
Thanks, u are the best, but i need two last things.

1) Is there any way to do this?: When i launch the setup.exe i want it to check if the app is already installed, if that is the situation, launch the uninstall program before performing the installation (Very useful for the new releases)

2) When launching the uninstall, check if the app is running, and if so happens, close it before performing the uninstall..


I hope i can explain myself clearly.. as u probably deduced, i am not english talking 😉

Thanks a lot mate
Animaether#
1. Yes.
read the uninstaller location from the registry (ReadRegStr)
- if the read string is empty, your app probably isn't installed (short of the user mucking with the registry)
- if the read string isn't empty, your app probably -is- installed.
-- check whether the uninstaller file exists (IfFileExists)
--- if it doesn't exist, the user moved or deleted the files after installation, can't do much about that 🙂
--- if it does exist, throw up a messagebox stating that you'll be running the uninstaller first
---- run the uninstaller

2. http://nsis.sourceforge.net/Detect_i..._and_close_it.
Animaether#
Oh, step 1 is detailed here as well:


Though it lacks the check whether the uninstaller file exists (it tries to run it, regardless, and if an error occurred (such as the file not existing), it skips. Cleaner to check whether the file exists first 🙂
Xi0Ns#
Thanks!!! is a really good idea.. i will try to do it..

thanks a lot.. but i still need to know how to close the running app...

Thanks, again to all of u 😉