Archive: Select and execute files from a directory


Select and execute files from a directory
Hi

I want to do an installer, but i don't know a good solution for some problem. I want to make an installer which get the executable files from a directory next to the installer, what is named "Plugins", and i want it to show that plugins in the components page, the names on the components page would be the executable file names.

My problems: i don't know how to read the file list of a directory, but if it is not possible, i can generate a ini file what the installer will read for the files, so this is not a big deal.

Main problem: on the components page i only can show the section names, and i would enerate sections only when i compile the script, not in runtime.
If there is no solution for this, can i make a custom page what is very similar to component page?

Thanks every help, and sorry for my bad English.


You can enumerate the plugins using FindFirst, FindNext and FindClose. You cannot dynamically add sections in NSIS so you will need to create a custom page with your executable list using nsDialogs.

Stu


As far as I know sections are defined at compile time, so I don't think there's a way to populate the Components Page's sections list depending on what 'plugins' exist next to the installer. That is assuming of course that you want to do this at runtime. One workaround you can use is create 50 hidden (and disabled) sections, and during runtime enumerate all plugin filenames and rename and un-hide one section for every plugin.

You could also create a fake components page using nsDialogs, and add one fake section for every plugin, but I doubt if that's going to be easier.


If you want to populate the list at compile time you can use a vbs script or something to enumerate all plugin filenames and use them to write to an nsh file which you can then !include. There's a post somewhere in these forums that explains how to execute a vbs script during installer compilation.


Thanks
Thanks for the replies :)
Now i can continue make the installer whith this help :)