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 / venki
Function Replacestring(filepath,find_string,replace_string)
Const ForReading = 1
Const ForWriting = 2
Dim obj,notepad,myline,newText
Set obj = CreateObject("scripting.FileSystemObject")
Set notepad=obj.OpenTextFile(filepath,ForReading)
Do Until notepad.AtEndOfStream
myline = notepad.readall
loop
msgbox myline
newText = Replace(myline ,find_string,replace_string)
Set notepad = obj.openTextFile(filepath, ForWriting )
notepad.WriteLine newText
notepad.Close
msgbox newText
end function
Call Replacestring("C:\New Folder\fade to
black.txt","me","you")'>mention your file path,string to
find,replacing string.
Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
Can the user toggle between using Local OR and shared OR for the same action?
What is the Command used to start the QTP
How many types of recording modes in the qtp?
What is a data driven test in qtp?
what r the verstions from 1st to present (verstions) of mercury tools (like winrunner,QTP,Loadrunner) ? Chandana
What is the difference between Keyword Driven test and Data Driven test?
Which functionalities of QTP used in banking project?
What are metrics and matrix?
What environment does qtp run in?
www.icici.com after this home page wll came, in this page what r the items we r going to test for manual and what the element we r test for QTP... explian clearly with example
wht is Manual Testing Frame work. Pls anybody can give appropriate answers
They asked by using qtp recording writing scripting
Hi, I got error message as "object does not support this property or method: "Test.Actions" when i execute the following line of script on QTP 9.0 Dim qtApp, qtRep Set qtApp = CreateObject("QuickTest.Application") Set qtRep = qtApp.Test.Actions("Action1").ObjectRepositories Can anyone tell me where i am wrong.
What is QTP testing process?
Does QTP10 supports Windows 7OS +IE 9 combination? Which is the preffered combination ,Plz let me know?