Archive: How to code a page with "minimal" and "full" install options


How to code a page with "minimal" and "full" install options
  Hi, I'm trying to create an app that has a custom page with two options (icons?); "minimal install" and "full install" - similar to a Microsoft Office type of installation. Depending on which the user selects, I'd like to call the appropriate code. Can anyone give me a brief explanantion of how to do this - I've tried searching but aren't really sure what I'm looking for!. Thanks


I guess by that you mean that you don't wish to show a components page that it may be customized to show only minimal and full install types, right?
Did you already set up the custom page or we're talking start from scratch?


Hi, yes, that's correct - so when the app starts it would go to this "selection page". Once I knew what type of install they require I can then present pages that will have different type questions. For example the "full" one will have some more text fields that will contain paths to progs only available in the full release.

I've not set any custom pages up yet as I'm still trying to plan/workout exactly what I need to do!


briefly,
you'd need to get your self familiar with InstallOptions by examining the included examples up to the point that you'd be able to design a custom page and add the desired controls.
mainly you'd need 2 grouped radio buttons one for full install and the other for minimal.
also, you need to define your sections as optional with /o switch. in custom page's leave function you're getting user's choice and accordingly you're enabling sections with SectionSetFlag.


great stuff - that's exactly the info I need; at least now I know the sequence and where to look. Thanks for that!


you're welcome!
give me a break and i'll show you an example


compile and execute the following example and see the difference in log window when you choose different install types :)

Name "My Application"
OutFile 'test.exe'
ShowInstDetails show
LicenseData '${NSISDIR}\License.txt'
LicenseBkColor 0xFFFFFF
InstallDir '$PROGRAMFILES\$(^name)'

Page License
Page Custom customcreate customleave
Page Directory
Page InstFiles

Section "main app" sec01 ;executed only for minimal install
setoutpath '$INSTDIR'
SectionEnd

Section /o "additional files" sec02
SetOutpath '$APPDATA'
sectionend

section /o "common files" sec03
setoutpath '$COMMONFILES'
sectionend

function customcreate
push $1
InstallOptions::Dialog '$PLUGINSDIR\custom.ini'
pop $1
Pop $1
functionend

function customleave
ReadINIStr $1 '$PLUGINSDIR\custom.ini' 'field 1' 'state'
Strcmp $1 '1' end
SectionSetFlags ${sec02} 1
SectionSetFlags ${sec03} 1
end:
functionend

function .onInit
InitPluginsDir
GetTempFileName $0
Rename $0 '$PLUGINSDIR\custom.ini'

WriteINIStr '$PLUGINSDIR\custom.ini' 'Settings' 'NumFields' '2'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'type' 'radiobutton'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'left' '20'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'right' '-20'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'top' '20'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'bottom' '32'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'Text' 'minimal install'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'state' '1'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 1' 'flags' 'group'

WriteINIStr '$PLUGINSDIR\custom.ini' 'field 2' 'type' 'radiobutton'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 2' 'left' '20'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 2' 'right' '-20'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 2' 'top' '40'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 2' 'bottom' '52'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 2' 'Text' 'full install'
WriteINIStr '$PLUGINSDIR\custom.ini' 'field 2' 'state' '0'
functionend

Red Wine you've provided a great working example! I've even added another option 'Typical' to it.

And Drod I must thank you for asking such a good and more precisely real-life project Question.

Red Wine is just doing great job. By the way where is Bruno?


Hi Red Wine. Thanks for all the help and especially the code example - it would have taken me ages to get to that!

I've just got back on line so will start to work through and make sense of it.


stop that.

there's a faaaaaaare more easy way than this.

use the normal components page and use "InstType" settings.

for every section you can set:


InstType "Full"

>InstType "Minimal"

>Section test testid
SectionIn 1 #section is in installtype Full only
>SectionEnd

Section test2 testid2
SectionIn 1 2 #section is in installtype Full and Minimal
>SectionEnd
>
you also can use sections without using SectionIn, they then can only be selected in "Custom" InstType (which is always predefined, see NSIS doc, chapter 4.8.1.24 InstType.

stop that.
I assume this is addressed to me right?
Stop what?
What exactly is bothering you and I'm supposed to stop it?
What is your problem anyway, unless you were blind you would seen above that I've already asked drod why not a components page.
Sorry if when I post it bothers you, I'm not posting on threads that you have opened, I'd never do I promise, but I can't do something beyond this because I intend to keep posting, so you'd have to deal with your problem!

well, this was in no wy ment agressive, plz do not missunderstand this :)

it was rather ment that you two are discussing about quite a biiig and complicated solution. i just meant you should not waste so much time with installoptions before trying out nsis' included functions :)


sorry again, if you thought i was attacking you.
i appreciate how you're helping ppl in this forums, don't take it personally.


Originally posted by Comm@nder21
well, this was in no wy ment agressive, plz do not missunderstand this :)

it was rather ment that you two are discussing about quite a biiig and complicated solution. i just meant you should not waste so much time with installoptions before trying out nsis' included functions :)


sorry again, if you thought i was attacking you.
i appreciate how you're helping ppl in this forums, don't take it personally.
Regarding to my self, I like to "waste" my time keep trying with NSIS, and I also like to share this "time wasting" with others, but only when they have request this share, so you'd better avoid reading my posts if you wish to save your time.
Last and least. When I'm able, I like to welcome new users who asking for help related to NSIS, by the mean to show them, how great, and far beyond a typical installation system, stands this incredible scriptable system.
That's all.

i do too, but i also always try to find just any solution.

so the first that comes to my mind will be taken, except it will probably take more time to implement it than to think about a more simple one.

and yes, i often just overfly your posts, but this is what i do with all forum posts, if i do not need the exact knowledge at the moment and just a hint what all is about.


Dealing with you here? That's the real waste of time ;)
I do not intend to waste my time here, nor I intend to control what I'm going to write when I'm answering to user's request, taking in account that you might not approve my post ;)


hey, hey :)

at least i am still dealing with you and do NOT see that as a waste of time ;)

irc is a waste of time, yes :D but nevertheless its great fun... you ought to come there sometime, then we could continue such useless discussions :D ;)


I have serious problems to browse the forum since last evening! Who knows what's going on...
Anyway... comm@nder21 see my new signature ;)


I saw that signature and can't figure out what it means in English!

Maiden castle?? absolutely no idea.

"not willing to defeat the human stupidity"?? = unwilling to attempt to conquer human stupidity? I don't know. Oh well, I guess it's just more drek the internet floated my way.


@demiller9 thanks for the help with english,
defeat is wrong expression? should I change it? I do not mean conquer, I mean something like 'try to deal with'...
Maiden castle = unbeatable castle, also wrong?

edit:
done, removed until i find the correct expressions, often I use a dictionary to translate my expressions, seems the translation is not successful all the time, or my expressions are too complicated to be translated correctly :)


@Red Wine - We're getting off topic here, but...
I think (after your last post) perhaps the 'maiden castle' might be an 'invincible fortress'? I don't recall the exact signature now, so its hard to say how to improve it.

I realize English isn't the native language for everyone, and I thank everyone for making the effort to use it.

Don