/build/static/layout/Breadcrumb_cap_w.png

Editing texts in installed files

Hi there, i have a package which installs files to "c:\filepath, some of these files have got TEXT entries in them which points to a server , my task now is to edit those server entries and change them to point to "c:\my desired file path".

Whats the best way of achieving this task without using a "REPLACE ALL" approach. Thx

I found a similar issue on the forum but is more applicable to oracle tnsnames.ora and not quite what i need.

Thanks for your replies

0 Comments   [ + ] Show comments

Answers (3)

Posted by: turbokitty 17 years ago
6th Degree Black Belt
0
Is it an INI file?
Posted by: bheers 17 years ago
Second Degree Blue Belt
0
If you can use wise scripts to do that job.

read the file into a TEMP var

now use if statement to see if the line contains C:\filepath.

if it contains the specified string, parse the string and attach C:\My desired file path to the text and write it to a temp variable"
and write the same variable back into the file with updated values.


using VB script it might be easier.
Posted by: AngelD 17 years ago
Red Belt
0
After the InstallFiles action you could use a vbscript custom action like this

Dim FilePath : FilePath = "C:\Program Files\directory\filename.ext"
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
Dim stream : Set stream = FSO.OpenTextFile(FilePath)
Dim IniData : IniData = stream.ReadAll
stream.Close

IniData = Replace(IniData, "[Replace Me]", "replace with this text")

Set stream = FSO.OpenTextFile(FilePath, 2)
stream.Write IniData
stream.Close
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ