Archive: create a form that allows the installer to change setoutpath


create a form that allows the installer to change setoutpath
How do i create a form that allows the Installer to change the output path of each option selected?


InstallOptions, but better use the free form page creation from HM NSIS edit... also see info about dirrequest.


It would probably be easier to use multiple Directory pages (the same amount as your Sections).
You'd call Abort in the page's Pre function's if a Section wasn't selected (using the SectionGetFlags).
For all your Directory page's you should use PageEx, and in each PageEx block use DirVar to specify the variable for that Directory.

Example:


Var Outpath1
Var Outpath2

PageEx directory
DirVar $Outpath1
DirText "Choose Install Location for Section 1" "Setup will install \
Section 1 to the following folder$\r$\n$\r$\nTo install to a different \
folder, click Browse and select another folder." "" ""
PageCallbacks directory1_Pre "" ""
PageExEnd

Function directory1_Pre
SectionGetFlags ${Section1} $R0
StrCmp $R0 1 +2 ;Section 1 is selected
Abort
FunctionEnd

PageEx directory
DirVar $Outpath2
DirText "Choose Install Location for Section 2" "Setup will install \
Section 2 to the following folder$\r$\n$\r$\nTo install to a different \
folder, click Browse and select another folder." "" ""
PageCallbacks directory2_Pre "" ""
PageExEnd

Function directory2_Pre
SectionGetFlags ${Section2} $R0
StrCmp $R0 1 +2 ;Section 2 is selected
Abort
FunctionEnd

Section "Section 1" Section1
SetOutPath "$Outpath1"
File "blah.txt"
SetOutPath "$Outpath1\otherblah"
File "otherblah.txt"
SectionEnd

Section "Section 2" Section2
SetOutPath "$Outpath2"
File "grky.txt"
SetOutPath "$Outpath2\othergrky"
File "othergrky.txt"
SectionEnd


Should work nicely :)
Not sure about using it with Modern UI though...

-Stu

Every option to separate directory - this looks like few applications in the package (Acrobat Reader, IE 6.0 and others) - if so, you can write super installer with options and few mini-installers - for every application, I saw sample somewhere on the forum pages. Hide 'super' when 'mini' is running.


Ok I get the picture but still need help
AFROW

I need a reply asap...
Is there a way for :

1. the sections to show on one window [standard nsis interface]
2. the decription on right as your select them[standard nsis interface
3. directory dialog at hte bottom below the selection[just the attached pic]
3a. When you change the selection the setoutpath changes in the directory dialog and you can click the browse button to chang the directory of that selection on the same page.

I have over 10 items and don't want the installer to page through each selection to change the browse directory of each selection.
I would love the installer to allow the End User to change the directory information that pops in the directory dialog based on the selection he has highlighted on the same page.

See the picture i included. I am not sure how to get this done. Need some help.

Thanx in advance.

Darius


Hmm this is a very very big task, even for someone like myself.

There is no default behaviour for any of this. NSIS' directory dialogue is standardised as being seperate as no one has ever requested for seperate directories for each Section.

If you were to do any of this you'd firstly need to use Modern UI (which would make the above code unworkable).
Modern UI allows for Section descriptions. NSIS' classic UI does not.

To add the directory controls like you showed on the attached image, you would have to write a plugin. You can hack Modern UI's UI exe with Resource Hacker and add them yourself, but that would be useless as you cannot have 'clickable' buttons on non InstallOptions dialogues without modifying NSIS' source code (you won't be able to have a 'Change' button on there).

I'm sorry but you will have to either use my solution or use multiple installers for each program/Section you want to install. You can have 1 main installer with the components page. In each Section of this main installer, the secondary installers are uncompressed and executed (using say ExecWait). They'll just have the basic directory page and InstFiles page.

-Stu


assign a variable to a dirrequest and read it back into setoutpath
How do I assign a default variable to dirrequest?
How do I assign the directory the user selected by using the dirrequest browse button to the setoutpath?

Is there a way to activate OnClick for a checkbox? I want to enable or disable a box based the user checking the checkbox


Use WriteINIStr to manipulate your InstallOptions INI file before you call InstallOptions::dialog
Use ReadINIStr to read values from your INI file.
Use the SelectSection macro in Sections.nsh to select Sections on the Components page, and the UnselectSection macro to unselect them.

-Stu


Can you send me an example script
Can you send me an example or sample script that I can use? I would very much appreciate it.

Thanx in advance.
Darius


There are examples in your Examples, and Contrib\InstallOptions folder that contain code for manipulating/reading user input.

-Stu