Archive: Having an Install Component change based on an "if"


Having an Install Component change based on an "if"
Hey. I'm trying to do something that I'm not sure is entirely possible. I want NSIS to detect if a file exists, and if the file does exist, to uncheck one of the installation components. If the file does not exist, leave it checked. I'd like to do this without creating Install Types, but if that is the only way, I'd be open to it. If it wasn't for the "if" factor, I'd be able to do it with just a standard install type now. If I could do this by reading a Registry key, that would also be acceptable. Anyone have any thoughts or ideas?

Also, is it possible to use a JPEG file as a splash screen instead of a BMP. I haven't tried it yet, but I thought I'd ask while I'm here.

[Edit]Oh I almost forget. _GREAT_ program. Very versatile and useful. I'm currently using it on two separate projects and I'm very happy with it. Keep up the good work.

-PJ
http://www.Tribes2maps.com


Doh. Since no one has an idea, looks like I'm going to have to deal with it as is. =/

-PJ
http://www.Tribes2Maps.com


Well, what exactly are you trying to do???? And no, NSIS's Splash doesn't use .jpg files.

-Duane


One of the install components is a server list. If a user is just installing the program on top of an existing installations (upgrade) then I want it to detect that the servers ini file exists, and if it does, uncheck that component by default. Not disable it or anything, just be somewhat "smart" as to what its doing. Does that make a little more sense?

-PJ
http://www.Tribes2maps.com


couldn't you just include this into the main selection and just do a

IfFileExists $INSTDIR\somefile.ini NoInstall 0
File somefile.ini
NoInstall:

this would just put the list there if it isn't already found.


I'm currently doing that now, kind of. The problem with that is I want the user to have a choice on what they do at the Install Components screen. So if they upgrade and WANT an updated server list (which many will) they can just check that box.

-PJ
http://www.Tribes2Maps.com


Use a YES|NO message box after ifFileExists, like this:


IfFileExists $INSTDIR\somefile.ini AskInstall 0
File somefile.ini
AskInstall:
MessageBox MB_YESNO "Would you like to install an updated server list?" NO NoInstall
File somefile.ini
NoInstall:

Is that helpful?

I am actually wanting to do something every similar.
I have an application which is composed of 3 programs. The user can install each program onto different computers and they communicate via the network. Each program is in it's own section. One of the programs will only run if the user has a certain application loaded, and I'd like to uncheck that particular section if the application isn't loaded. Otherwise, I'd like check it by default.

Putting it into code which just skips it isn't really an option. Right now, I just leave it unchecked by default. I'd actually like to disable it to the point where the user *can't* select it, but would settle for just leaving it unchecked.

I'm about to dig into the code to add this there isn't already a way to do it. (is Justin finished with the wild coding updates? would hate to have to repeat it repeatedly.)

thanks.