/build/static/layout/Breadcrumb_cap_w.png

Script for searching & editing a file

Navigate to C:\test
Open test1.config in Notepad
Search for <test2> After the line that starts <add name="test3"........
insert the following line
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.102.3.2, Culture=neutral, PublicKeyToken=89b483f429c47342" />
Save the test1.config file.

0 Comments   [ + ] Show comments

Answers (7)

Posted by: anonymous_9363 16 years ago
Red Belt
0
This post ought to be in the 'Scripting' forum, no? I expect one of the moderators will move it.

Anyway, this is an XML file, by the look if it? I have an XML WMC which I've used FOR ONE PURPOSE. I emphasise that because I've not used it in about 3 years and therefore can't vouch for the efficacy of the other functions, nor did I spend a great deal of time working out how to use them.. It should be a trivial task to turn the WSC into a class which you can incorporate into the script.

I've deposited a copy http://senduit.com/b805af here. The link expires in 2 days.
Posted by: skj 16 years ago
Second Degree Brown Belt
0
can u pls post that script in this forum, i'm not able to open that site
Posted by: enzio 16 years ago
Orange Senior Belt
0
You Should use a deferred CA that reads the xml file, parametrized with public properties, and once read replace the parameters with the valid information.

On Error Resume Next
Dim WshShell, temp_line
Set WshShell = CreateObject("WScript.shell")
sFileName = path to the file to edit
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(sFileName, 1)
temp_line = objFile.ReadAll
temp_line =replace(temp_line , "text to replace", Session.Property("PROPERTY WHERE IS THE VALID TEXT"))
objFile.Close
Set objFile = objFSO.OpenTextFile(sFileName, 2)
objFile.WriteLine temp_line
objFile.Close

If you have more than one parameter you can set a property with all the Public properties to use separated with "|" and with a split command use in the script.
Posted by: skj 16 years ago
Second Degree Brown Belt
0
line should be inserted after the etxt is searched
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: skj
can u pls post that script in this forum, i'm not able to open that site
At a whisker under 12K in size, I doubt I'd be popular with the moderators. I can't email it to you, either, as my current client blocks attachments of this type (and yes, it does *sniff* the contents, so the old renaming tricks won't work.) If you have a site I can upload to, I can do that.
Posted by: bkelly 16 years ago
Red Belt
0
You may paste it into the site if you like, just use the CODE tags so that it will be placed in a text area (the <% icon on the toolbar).
Posted by: anonymous_9363 16 years ago
Red Belt
0
If your environment allows 3rd-party ActiveX controls, you could do worse than this http://www.chilkatsoft.com/xml-activex.asp

I don't know how you might insert the line in the position you want but the docs look pretty thorough.
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