I want to open a text file and then search some specified
text in it and then replace that text with some other text
i found that text in .txt but do not know how to replace
that text can any body help me. if possible put the code
for qtp
Answer Posted / rico
Const ForReading = 1, ForWriting = 2
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\working\replace.txt",
ForWriting, True)
f.Write "QTP QTP RFT QTP QTP RFT QTP QTP"
Set f = fso.OpenTextFile("c:\working\replace.txt",
ForReading)
ReadAllTextFile = f.ReadAll
newText = Replace( ReadAllTextFile, "QTP", "QTPRO")
Set textFile = fso.OpenTextFile
( "C:\working\replace.txt", ForWriting )
textFile.WriteLine newText
f.Close
| Is This Answer Correct ? | 12 Yes | 4 No |
Post New Answer View All Answers
A FORM CONTAINS 5 FIELDS. 1 FIELD IS ENABLED REMAINING(4) FIELDS DISABLED. MY QUESTION IS ENTER VALUES INTO 1 FIELD AFTER THAT CLICK TAB BUTTON THEN 2 FIELD ENABLE THIS PROCESS CONTINUE UPTO 5TH FIELD. HOW TO WRITE CODE IN DESCRIPTIVE PROGRAMMING. PLZ TELL ME THE PROCEDURE AND CODE FOR IT.
How many ways is to parameterize the value?
What is the syntax to call one action in another?
What is system testing and what are the different types of tests you perform in system testing?
What are the benefits of quick test pro(qtp)?
How you calling actions in qtp?
what is actually contain test report? can anybody post the test report
Will there be any standards or requirements for page appearance and/or graphics throughout a site or parts of a site?
How to start recording using quicktest professional?
Through array we can execute the testcase how ? give me example
What is recovery scenario manager? When you go for recovery scenario manager?
How can i initiate the objects to find uniquely in OR
This is a question thats generally asked in every QTP interview. What were the problems that you faced during automation and how did you resolve them?
How many types of run modes are there in qtp?
Have you used xml check point in your project?