Archive: Silent install and the SelectSection macro


Silent install and the SelectSection macro
Okay, so I've just discovered that .onGUIInit and page callbacks do not work during a silent install.

What I am trying to do is check command line parameters for a silent install, and based on those parameters, use the SelectSection macro to turn on a section (they are all off by default). However I have yet to get it to work silently.

What would be the proper way to achieve this silently? I really want to avoid having the sections checked by default and then using IfSilent within the section to skip the code if the parameter was not given.


There's no need to check the command line parameters manually, you can use IfSilent. That, along with UnselectSection macro from Sections.nsh, should be enough. See the attached file for an example.


Sorry, I didn't mean that I was checking if the installer was actually silent, I meant I was checking if a command line parameter existed, and then enabling the section via SelectSection. However, this is not working when silent.

So like /feature1, /feature2 etc.

If /feature1 switch exists, then I use SelectSection ${feature1} etc.

However, this is NOT working for me in .onInit, and I have it placed as the last code in .onInit. To check, I even stripped out all the parameter checking, and just did:

!insertmacro SelectSection ${feature1}. The section is off by default, and whether I run it via command line or just double click the icon, when it gets to the component page that section is still not turned on.

I added a MUI_CUSTOMFUNCTION_GUIINIT command, stuck the SelectSection macro in a function that it called, and it DID work, but of course not when silent, only when ran by just double clicking the icon.


So something, somewhere is not letting the SelectSection, ReverseSection, and UnselectSection macros work during .oninit for me.


Are you sure ${feature1} is defined at that point of the script? MessageBox it and make sure it's not empty.


Thank you kichik.

It turns out I am an idiot. Prior to the call at the very end of .onInit, I had a function that checked if the user was connected to the internet, if they are I returned from the function, and if they weren't I wrote to some ini files. Since my test machine is always connected to the internet, it was always returning from the function and the SelectSection macro was never getting selected.

Anyway though, I realized this and instead of using Return I did label jumps (which I should have anyway), and now it's all working.


Thanks again for all your help.