Archive: Dropdownbox for possible Installpaths


Dropdownbox for possible Installpaths
Hi there,

I don't know if its possible to create what i want but if it is I definitly do need some help.

Ok what i want to do is is first to search the computer for 1 required file and 3 optional files wich must be in the same directory as the req. one. Lets call them "req1", "opt1", "opt2" and "info"

Than on the directory page instead of the normal box where you can put in your install directory have a dropdown box containing the paths found earlier. (but still should be able to manual point the installer to another location)

But it gets more complicated now, for a found path to be valid and shown in the dropdownbox it must behave like this:

req1 + opt1 or
req1 + opt2 or
req1 + opt1 + opt2

The last optional file ("info") is a dummy file wich comes with the installer containing a version number and date.
However if present it should read out a line of the dummy file and print it in light gray on the backdrop of the dropdownbox.

Also it should be sorted in 2 Groups in the box, all in all it should look like this. Note g1p1 means group 1 path 1 :)
req1 + opt1 should be group 1 and req + opt2 group 2, if it is req + opt1 + op2 the path should be added to both groups

Crappy Visualization:


1st Group Caption ;only shown if g1 path is present
------- ;as above
g1p1
g1p2

2nd Group Caption ;only shown if g2 path is present
------- ;as above
g2p1
g2p2 info ;"info" file found printing a line of it

Well thanks in advance.


You're going to have to make an InstallOption dialog with a ComboBox control. I'm pretty sure you can't place text in the background of the control though.

To search for files, you can either use my RecFind header for ease of use here:
http://nsis.sourceforge.net/RecFind:...t%2C_FindClose
Or use the Locate plugin, which will search for your files the fastest:
http://nsis.sourceforge.net/Locate_plugin

-Stu


${locate::Open} "C:\" "/N=req1 /-PN=Temp|WINDOWS /A=-READONLY|-ARCHIVE /SD=NAME" $var

${locate::Unload}


This would load the locate plugin, search for file named "req1" ignore temp/Windows directories and hidden/system files and sort the found paths alphabetical, then unload the plugin.

What i need in addition is to search all drives, so what do i put in the syntax for it above?
Also i don't quite get it how do save the found path(s), note that i need only the parent directory of the file when it was found eg. if file is at c:\hello\req1.exe i need c:\hello

A example of find fileA, hand path over for nextsearch would be appreciated.

Thanks again

There is a GetDrives function in one of the NSIS script headers (FileFunc I think). See NSIS documentation > Useful Headers.

To get the directory path of the file, use the GetParent function which should be under Useful Scripts in the NSIS documentation.

-Stu