Join us for SoftSummit 2023. The 20th anniversary of the industry leading software monetization conference. April 18 and 20. Register Now

cancel
Showing results for
Show  only  | Search instead for
Did you mean:
Level 5

Conditional Text File Update?

Hi All,

Is there a way to do a conditional update of a text file? For example, I have a text file that has a line in it that is "C:\Program Files (x86)\...". Can I do something where if the OS is 32-bit to modify that line to be "C:\Program Files\..." instead?

Thanks as always,
Brian
Labels (1)
• InstallShield 2012 Spring

4 Replies
Level 6
Hello.

Why don't you use [Text File Changes View]?

Text File Changes View
http://kb.flexerasoftware.com/doc/Helpnet/installshield19helplib/helplibrary/TextFileChangesView.htm

Specifying Search-and-Replace Criteria for a Text File Change
http://kb.flexerasoftware.com/doc/Helpnet/installshield19helplib/helplibrary/TextFileChanges-SrchRplc.htm#ConfiguringTargetSystem_814688173_TextFileChanges-SrchRplc

And I guess you can use Windows Installer Property INSTALLDIR as [INSTALLDIR].

If you write [INSTALLDIR], then that string will be replaced to actual install folder.
Level 5
weakness wrote:
Hello.

Why don't you use [Text File Changes View]?

Text File Changes View
http://kb.flexerasoftware.com/doc/Helpnet/installshield19helplib/helplibrary/TextFileChangesView.htm

Thanks, weakness! I see the text file changes but how can I make it change only if a certain condition is met. For example, I have a batch file that has C:\Program Files (x86)\... in it. I'd like to have the installer change it to C:\Program Files\... before I have a custom script launch. Otherwise I'll get an error.
Level 9
I think the text file changes are associated to a component.
you can condition the component and then in turn takes care of the text file changes
Level 6
rrinblue22 wrote:
I think the text file changes are associated to a component.
you can condition the component and then in turn takes care of the text file changes

I concur, this is the best way to make conditional changes to text/XML/ini files.