My 2 cents, a vbscript's function :
' Prerequisites ' Proprierty FILE : File Path + Its name ' Propriété LINE : what you want to replace ' Propriété REG_EXP : Reg exp to identify what you want to be replaced ' Theses 3 properties are passed throught CustomActionData's property. ' Sub Sb_File_Modify() Dim oFSO, oFile, vFile, vFileLine, vLine, vFind, vReg_Exp, vIndex vCAD = Session.Property("CustomActionData") vProperties = Split(vCAD,";") vFile = Replace(vProperties(0),"""","") vLine = vProperties(1) Set vRegExp = New RegExp vRegExp.Pattern = vProperties(2) vRegExp.Global = True vRegExp.MultiLine = True If Fn_File_IsExists(vFile) Then Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFile = oFSO.OpenTextFile(vFile, 1, False) vContent = oFile.ReadAll oFile.Close Set RegExMatches = vRegExp.Execute(vContent) For Each myMatch in RegExMatches vContent = Replace(vContent,myMatch.Value,vLine) vIndex = 1 Next If vIndex = 1 Then Set oFile = oFSO.OpenTextFile(vFile, 2, False) oFile.write(vContent & vbCrLf) oFile.Close End If Set oFile = Nothing Set oFSO = Nothing End If End Sub Le Mer 03 Avril 2013, à 20:46, chennam a écrit : Hey in Continuation of the previous solution (see previous comment) Can we do file search of Web.Prod.Web1.config and replace some content "web1" to "web2" on conditional basis based on [Computername] we are Installing? Like if [ComputerName] is WEBPQR then replace Web1 with web2 allover the content of the Web.Prod.Web1.config file dynamically(like file search and replace)? Thanks in advance. -- View this message in context: [1]http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Change -content-of-Config-file-after-installation-tp7584789p7584859.html Sent from the wix-users mailing list archive at Nabble.com. ----------------------------------------------------------------------- ------- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal [2]http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ WiX-users mailing list [3]WiX-users@lists.sourceforge.net [4]https://lists.sourceforge.net/lists/listinfo/wix-users -- Sincèrement, Gabriel "I know no way of judging the future but by the past." Patrick Henry "You can never plan the future by the past." Edmund Burke References 1. http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Change-content-of-Config-file-after-installation-tp7584789p7584859.html 2. http://www.cisco.com/web/learning/employer_resources/index.html 3. mailto:WiX-users@lists.sourceforge.net 4. https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users