Dekard
Posts: 1
Joined: Mon Nov 12, 2007 3:31 pm
Contact:  Website

config file and cores detection

Mon Nov 12, 2007 3:55 pm

I'd like to ask the user for some details and then pass those to a configuration file.

To explain, here's the questions and responses I need from the user and I'll post a sample of the onfiguration file below as generated by the application under normal circumstances.

username
team

Code: Select all

[settings]
username=Dekard
team=77826
asknet=no
machineid=1
local=1

[http]
active=no
host=localhost
port=8080
usereg=no
Also, it would be handy to be able to detect the number of cores\processors available to windows at the time of installation and create as many folders are there are cores\processors, ie. the user has a quad core so I'll make 4 folders and copy the install contents into each folder. I'll also copy the above config file into each folder increasing the 'machineid' by one each time. So, folder 1 would contain the exe and config with a machineid of 1, folder 2 would contain the exe and config with a machineid of 2, etc...

Whats the best way to accomplish these two things? Note, this is the first time I've used an installation builder in about 5 years so, please, be gentle.

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:  Website

Mon Nov 12, 2007 7:31 pm

Hi,
To explain, here's the questions and responses I need from the user and I'll post a sample of the onfiguration file below as generated by the application under normal circumstances.

username
team
This can be done by creating a custom dialog. The dialog will use editbox controls to store the information into properties. You can read more about the Dialog Editor here:
http://www.advancedinstaller.com/user-g ... ditor.html
Also, it would be handy to be able to detect the number of cores\processors available to windows at the time of installation and create as many folders are there are cores\processors,
You can create a custom action that will get the number of cores available using environment variables. This custom action will set four properties, and their values will depend on the number of cores.

For example:
- the custom action detects 2 cores using the NUMBER_OF_PROCESSORS environment variable
- it sets the four properties
- two will have values (the paths of the folders that correspond to the two cores) and two will be empty (because there is a maximum of four cores)
- in the "Files and Folders" page you have property-based folders for all four properties
- these folders contain the corresponding EXE files
- in the "Organization" page the component of each folder is conditioned by the value of the corresponding property (the folder will be installed if the property is not empty)

You can read more about custom actions here:
http://www.advancedinstaller.com/user-g ... -page.html

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”