Archive: Multiple Setup question


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?


Function .onInstSuccess
Exec "$EXEDIR\setup2.exe"
FunctionEnd


how would I go about calling that function?


It will be called automatically when the setup program finishes unless the install is cancelled or aborted.
see onInstSuccess

Don


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?


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}"


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.


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.

I would just do something like

File setup2.exe

.onInstSuccess

Execwait setup2.exe

delete setup2.exe


Originally posted by jackkoho
I would just do something like

File setup2.exe

.onInstSuccess

Execwait setup2.exe

delete setup2.exe
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?

excuse me, im a newbie


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.


FindWindow is pretty easy, for instance,

# 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

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.


Think about how you will check if the game is installed. Registry? Existence of files?

Stu


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.


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


The second installer already looks in the registry to know where to install its files.