Old 24th May 2007, 02:00   #1
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
Multiple Setup question

Is there a way to run a second setup wizard after the first one has finished and the user has press Finished from a DVD?

for Example:
Setup1 installs
Setup2 is called after the user clicks finish in Setup1.
Both Setup1 and Setup2 are on a DVD.

How can I do this?
Guardian9978 is offline   Reply With Quote
Old 24th May 2007, 14:01   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Function .onInstSuccess
Exec "$EXEDIR\setup2.exe"
FunctionEnd

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 24th May 2007, 19:28   #3
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
how would I go about calling that function?
Guardian9978 is offline   Reply With Quote
Old 24th May 2007, 19:52   #4
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
It will be called automatically when the setup program finishes unless the install is cancelled or aborted.
see onInstSuccess

Don
demiller9 is offline   Reply With Quote
Old 25th May 2007, 09:04   #5
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
Since my next questions are on the same topic...

1. How can I make it so that if the user doesnt install Setup1 first and runs Setup2 Manually that the Installer will tell the user to run Setup1 first?

2. How can I make it so that if Setup1 was ran and they try to run it again it gives them the uninstall?

Likewise if when the user trys to run setup2 again after it has already been installed make it so that it give them the uninstall?
Guardian9978 is offline   Reply With Quote
Old 25th May 2007, 10:23   #6
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
1. write a key in the registry when setup1 complete successfully. check this registry key in setup2
2. check the standard registry key where unistaller names are kept and run the uninstaller
I use this defines at top of my install scripts:
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

then define PRODUCT_NAME to what you want
and in the uninstaller code add something like:

WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
sgiusto is offline   Reply With Quote
Old 25th May 2007, 11:00   #7
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
I should have mentioned im new at this... im learning slowly but im still figuring everything out. After I get these last 2 things in my installer is done.
Guardian9978 is offline   Reply With Quote
Old 25th May 2007, 18:10   #8
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Quote:
Originally posted by Guardian9978
Since my next questions are on the same topic...

1. How can I make it so that if the user doesnt install Setup1 first and runs Setup2 Manually that the Installer will tell the user to run Setup1 first?

2. How can I make it so that if Setup1 was ran and they try to run it again it gives them the uninstall?

Likewise if when the user trys to run setup2 again after it has already been installed make it so that it give them the uninstall?
You may use GetParameters to check if setup2 called from setup1 or a simpler way, FindWindow from setup2 to check if setup1 is running.

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 25th May 2007, 18:50   #9
jackkoho
Member
 
Join Date: Oct 2006
Posts: 70
I would just do something like

File setup2.exe

.onInstSuccess

Execwait setup2.exe

delete setup2.exe
jackkoho is offline   Reply With Quote
Old 25th May 2007, 19:11   #10
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Quote:
Originally posted by jackkoho
I would just do something like

File setup2.exe

.onInstSuccess

Execwait setup2.exe

delete setup2.exe
Quote:
Originally posted by Guardian9978
Is there a way to run a second setup wizard after the first one has finished and the user has press Finished from a DVD?

for Example:
Setup1 installs
Setup2 is called after the user clicks finish in Setup1.
Both Setup1 and Setup2 are on a DVD.

How can I do this?

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 25th May 2007, 19:52   #11
jackkoho
Member
 
Join Date: Oct 2006
Posts: 70
excuse me, im a newbie
jackkoho is offline   Reply With Quote
Old 26th May 2007, 06:36   #12
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
well the first response about having setup2 run after setup1 is done worked for me i just need to get the last 2 questions explained more since i really dont understand how to do any of it.
Guardian9978 is offline   Reply With Quote
Old 26th May 2007, 07:21   #13
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
FindWindow is pretty easy, for instance,
code:
# setup2 checking if setup1 is running
function .onInit
FindWindow $0 "" "Setup1_Window_Title"
strcmp "$0" "0" _noexec _doexec

_noexec:
MessageBox MB_OK "My_Message"
Quit

_doexec:
# continue installation
functionend


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 26th May 2007, 09:14   #14
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
Not what I was meaning... Sorry if I wasn't more clear

What I wanted is to have:

Setup1 check to see if the game is installed on run and if it is then show uninstall Dialog

Setup2 same as setup1 but only after it is finished with its installation.
Guardian9978 is offline   Reply With Quote
Old 26th May 2007, 13:03   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Think about how you will check if the game is installed. Registry? Existence of files?

Stu
Afrow UK is offline   Reply With Quote
Old 26th May 2007, 22:53   #16
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
existence of files would be good. That way if the user tries to run setup2 before setup1 I would be able to tell them to run setup1 first.

for example:
setup1 installs:
1.file
2.file

and setup2 installs:
3.file
4.file

Setup1 installs its files and then if the user tries to run setup1 again it will find the files setup1 already installed and gives the user to uninstall.

Setup2 on run will check for setup1's files and if it finds them then installs its files.

if Setup2 doesn't find setup1's files it tells the user to run setup1.

After setup2 is done and they try to run setup2 again it checks for the existence of the files and if they exist then it shows them the uninstall.
Guardian9978 is offline   Reply With Quote
Old 27th May 2007, 19:52   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
But at the end of the day, you would probably have to use a registry entry for this. If the first installer writes the install path to the registry, then you can read that path in the second installer.

Edit: Perhaps a good solution for this first and second installer installation order dependency would be to use InstallDirRegKey. If the first installer writes the path after a successful install, the second installer can check if that registry entry exists to determine if the first install has been completed.

Stu
Afrow UK is offline   Reply With Quote
Old 28th May 2007, 06:09   #18
Guardian9978
Junior Member
 
Join Date: May 2007
Posts: 8
The second installer already looks in the registry to know where to install its files.
Guardian9978 is offline   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