thoste
23rd April 2003 12:43 UTC
Defining InstallDir interactively ???
Depending on the answer of the user I want to assign the final InstallDir interactively.
As far as I understand the function
.onInit is called prior to ALL (other) Sections.
Is this correct?
Are there any restrictions for this .onInit function ?
Read: Can I put something like the following code into
the .onInit function (ignore possible line wraps) and access later
the contents of InstallDir ??
Function .onInit
...
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install version A? IDNO LabelB
InstallDir "C:\project\pathA"
Goto continue
LabelB:
InstallDir "C:\project\pathB"
continue:
....
FunctionEnd
Section "mystuff"
SetOutPath $INSTDIR ; Path from above should be assigned
....
kichik
23rd April 2003 13:51 UTC
Yes, .onInit is called prior to any other code in the installer. Your code should theoretically work, all you need to do is replace InstallDir with StrCpy $INSTDIR C:\something.
I recommend you use a nice InstallOption page to let the user choose.
thoste
23rd April 2003 14:52 UTC
Not working !!
The code is NOT working!!!!
I am getting an error message when I compile the script
Error: command InstallDir not valid in function
Why ?
Is it possible to code
StrCpy $INSTDIR "C:\myproject"
?
Would this be equal to the InstallDir command ?
kichik
23rd April 2003 14:57 UTC
As I said you have to replace it. InstallDir just defines the initial value of $INSTDIR, which can be later overriden with StrCpy $INSTDIR C:\something. InstallDir can only be used outside of sections and function, StrCpy can only be used inside sections or functions.