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

Text File Changes using Environment Variable

Hi

I am currently using InstallShield 2011 and I am trying to make a Text File Change to an installed file using an Envirnonment Variable.

This is what I have in my criteria:

Find What:
Replace With:

But this does not work as I am not sure of the actual syntax to use when replacing the IP address with the name of the computer using the Environment Variable %COMPUTERNAME%.

Many thanks

Ian
Labels (1)
0 Kudos
(2) Replies
Cary_R
Level 11

Hi There,

I posted briefly on this on the blog:

http://blogs.flexerasoftware.com/installtalk/2011/02/i-didnt-know-installshield-could-do-that.html

Use Property References All Over the Place

If you find yourself saying, "Boy, I wish X feature could use a Property reference", there's a sort of process you can go through to figure out if this is a possibility:

1. Check to see where the Table data is stored. Basically, type a descriptive string into the UI you are using to configure whatever data, and search for it in InstallShield's Direct Editor.

2. Once you've found the table record that holds your data entered in step 1, press 'F1' to bring up the Table Reference.

3. If the field has a data type of 'Formatted', then it can use a Property Reference. There are some other field types that also support this formatting:

Template

Path

RegPath

AnyPath

FormattedSDDLText

Shortcut

InstallShield-Specific tables (Generally named like ISxxx...) is a separate topic, however. Since these tables are used internally are not intended to be manipulated directly, there's no table reference for them.

However, while not advertised in all parts of the Product, generally the InstallShield Developers will use the Windows Installer API "MsiFormatRecord" when processing a data table in an *.msi package:

MsiFormatRecord Function

http://msdn.microsoft.com/en-us/library/aa370109(VS.85).aspx

If a data table contains a string value of some sort that's not obviously used as a Primary key, there's a decent chance it will be formatted by the associated InstallShield Custom Action at runtime before the data is used. My recommendation is to try a property reference if you're not certain, and see if this works for you.


Basically, what this means to you is to try changing it to:

0 Kudos
Orbian
Level 2

Hi Cary

Thank you for your reply. That worked a treat. I also found, from reading your blog, that the environment variable 'ComputerName' is set by the Installer at run time. As well as your suggestion, I also tried the following, with success, in order to place the environment variable into a string (required for a text change within an xml file):



Many thanks for your help.

Ian
0 Kudos