Old 24th November 2005, 08:22   #1
flyakite
Member
 
Join Date: Dec 2003
Location: Chicago
Posts: 50
Send a message via AIM to flyakite Send a message via Yahoo to flyakite
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.
flyakite is offline   Reply With Quote
Old 24th November 2005, 12:35   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.
Attached Files
File Type: nsi test.nsi (297 Bytes, 262 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th November 2005, 15:24   #3
flyakite
Member
 
Join Date: Dec 2003
Location: Chicago
Posts: 50
Send a message via AIM to flyakite Send a message via Yahoo to flyakite
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.
flyakite is offline   Reply With Quote
Old 24th November 2005, 15:31   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Are you sure ${feature1} is defined at that point of the script? MessageBox it and make sure it's not empty.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th November 2005, 15:53   #5
flyakite
Member
 
Join Date: Dec 2003
Location: Chicago
Posts: 50
Send a message via AIM to flyakite Send a message via Yahoo to flyakite
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.
flyakite is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump