Conditionally Add a Property to an INI File - Advanced Installer Community
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Conditionally Add a Property to an INI File

I need some help with configuring my Advanced Installer project to handle the following scenario:

As part of my project I have an ini file that contains the following:

[Profile]
BuildTitle=
LogFile=
HelpFile=
LogOnFile=

As part of the installation process, BuildTitle, LogFile, and HelpFile property values will ALWAYS be assigned a value.

However, the LogOnFile property may or may not be set depending on what the user chooses to do during the installation process. If the LogOnFile property value does NOT get assigned a value I want to REMOVE the LogOnFile property from the ini file.

How can I do this?

It would be nice if I could conditionally add the LogOnFile property to the ini file when the installation process determines it has a value that can be assigned to the property.

Thanks in advance,

Todd
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Conditionally Add a Property to an INI File

Hello Todd,

To achieve what you want you can bind the "LogOnFile" ini entry with a component which will be installed only when the LOGONFILE property is set.

Please take a look on our "Install 32/64-bit files" article which exposes how you can condition a component installation.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Re: Conditionally Add a Property to an INI File

Hi Daniel,

I am not sure how the example you are referring to does what I originally asked? I do NOT want to conditionally install a file but rather what to conditionally remove a property that is in an INI file. The INI file is always installed.

To repeat.. I have an INI file that contains the following:

[Profile]
BuildTitle=
LogFile=
HelpFile=
LogOnFile= <------ I would like to remove this property from the INI file based on a condition.

So if during the installation process the user does not specify a LogOnFile I want to completely remove "LogOnFile" from the INI file. Under this scenario the INI file that is installed would contain...

[Profile]
BuildTitle=blah
LogFile=no
HelpFile=C:\xxxx\aaa.pdf

(**** Notice the INI file does not include LogOnFile ***)

Thanks in advance,

Todd
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Conditionally Add a Property to an INI File

Hello Todd,

Here it is attached a sample project, created with AI 12.7.2 version, which implements your installation scenario.
sample.aip
(15.17 KiB) Downloaded 403 times
Please check the INI file from "Files and Folders" page, the "Dialogs" page and the "Organization" page settings.

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Re: Conditionally Add a Property to an INI File

Hi Daniel,

Thank you for you sample project. However, I am currently using version 12.7.1 and cannot upgrade to 12.7.2. Is it possible for you to provide me with the sample project that is compatible with 12.7.1?

Thanks,

Todd
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Conditionally Add a Property to an INI File

Sure Todd.

Here it is attached a sample created with AI 12.7.1.
sample.aip
(15.17 KiB) Downloaded 494 times
Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Re: Conditionally Add a Property to an INI File

Hi Daniel,

Thank you so much! Your sample project provided the details on what I needed to do.

Todd
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Conditionally Add a Property to an INI File

You're always welcome Todd.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”