Archive: How to ask for a second install directory, in MUI


How to ask for a second install directory, in MUI
Hi,
my application consists of a few standalone exe as well as a couple of plugin dlls for another application.

The user should be able to choose the combination of which things they want, either the standalone bits, the plugins for another app, or in the normal case both.

The MUI_PAGE_DIRECTORY macro is used to ask the user for the main program directory, which is where all the standalone stuff is found.

For the plugins for the 3rd party app, it checks the registry to find out where the 3pa is installed.

However in some special cases the 3pa might be installed twice, say 2 different versions, and I would like a second MUI_PAGE_DIRECTORY type window to pop up and let the user either confirm the directory discovered in the registry or supply another one, ideally only if the user chooses the plugins section.

I am not sure how to do that, and havent found anything in the docs or examples that seems to do that.

After that I would like to be able to supress the standard MUI_PAGE_DIRECTORY in case the user only selects the plugins and not the standalone exes.

Basically I am looking for some per-section MUI_PAGE_DIRECTORY rather than a MUI_PAGE_DIRECTORY thats global to all sections.

Any hints? Thanks.


Var INSTDIR2

!define MUI_PAGE_CUSTOMFUNCTION_PRE Directory2Pre
!define MUI_DIRECTORYPAGE_VARIABLE $INSTDIR2
!insertmacro MUI_PAGE_DIRECTORY

Function Directory2Pre
ReadRegStr $INSTDIR2 ...
StrCmp $INSTDIR2 "" ShowPage
IfFileExists $INSTDIR2\*.* 0 ShowPage
Abort
ShowPage:
FunctionEnd


Abort when called in a page's PRE function will skip that page.

-Stu

Ahh thanks a lot, it looks a lot like the Add-on Custom Install example I was looking at. I have pretty much got what I wanted now, except for 1 small thing, both directory pages appear, even if I have don't select any sections that need INSTDIR2. Is there anyway to suppress a page being shown unless a section actually needs its var?

Thanks a lot you saved me a heap of time.