bjones8888
Posts: 5
Joined: Wed Jan 16, 2008 3:14 pm
Location: Kentucky
Contact: Website

How to read customized settings from text file (newbie)

I need to be able to read some installation values from a text file that I want to have customized per site - and use them to create registry keys and values. How does one accomplish this (using AI 6.1)?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

I'm afraid that this is not supported directly by Windows Installer.

However, you can create the registry entries you need by using the "Registry" page:
http://www.advancedinstaller.com/user-g ... istry.html

Since the registry entries can use properties, what you need can be done in two ways:
1) you can create your own EXE that will parse the file and launch the MSI with parameters that set the properties you will use
2) you create a custom action that reads the file and sets the properties

When the registry entries are created, the properties used by them will be resolved to the values read from the file.

There is a custom action on the forum which can be used as a starting point for the one you need, please take a look:
http://www.advancedinstaller.com/forums ... entextfile

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bjones8888
Posts: 5
Joined: Wed Jan 16, 2008 3:14 pm
Location: Kentucky
Contact: Website

Thanks for the prompt reply.

I don't need my Installer to read the values, I just need registry keys created to go along with the application I'm installing, and I want those registry keys to be different from one site to another. I'd like to avoid creating a separate msi for each site.

My application will read those reg keys and use them at runtime. I can create a program to read those values and create the appropriate keys, but I wanted to use AI because the end users won't have sufficient network rights to do this, and this msi will be pushed out to the users by the network administrators during the login scripts.

If I create a custom action and have it run my program that reads the values from the text file, will my custom program run with sufficient rights inherited because it's running from the msi program?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
If I create a custom action and have it run my program that reads the values from the text file, will my custom program run with sufficient rights inherited because it's running from the msi program?
If this custom action must be run elevated, it must be set as "Deferred with no impersonation".

The earliest stage under which you can schedule a deferred custom action is "InstallInitialize". Since the custom action will write registry entries, it must be scheduled before the "WriteRegistryValues" standard action.

You can see these standard actions by using the "Show standard action" button on the toolbar in the "Custom Actions" page. 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”