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

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Is it an INI file?
Answered 03/06/2007 by: turbokitty
Sixth Degree Black Belt

Please log in to comment
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.
Answered 03/06/2007 by: bheers
Second Degree Blue Belt

Please log in to comment
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
Answered 03/06/2007 by: AngelD
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity