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
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)
Please log in to answer
Posted by:
bheers
17 years ago
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.
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
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
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.
so that the conversation will remain readable.