Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to do call a output parameter from one action to another action??/

2314


How you calling actions in qtp?

998


How to creating an output value using quicktest professional (qtp)?

960


For which type of projects the iterative model is not suitable?

1823


What is the synchronization point in qtp?

941


any body can you help me what is the script to automate an comand promt

2430


How can get count of list box?

1060


What is the use of text output value in quicktest professional?

916


Hi we are using QTP9.0 for Seibel Application and this seibel application will give you a popup messagebox which is of web , so qtp takes 3 mins to recognize the messagebox and to click on it , we have more number of messageboxes like this . please suggest me some solution

2081


Explain how you can delete excel file in qtp?

997


What do you mean by iteration?

1132


i need to add 1000 users in a domain i written the script for that and it is running successfuly but the problem is that my system is not the user of that domain in which i have to add users so for adding users in that domain i have to install qtp on that another system, can anybody suggest me the way to add those users from my system ultimately i want to know how to access remote computer through script

1787


Explain the concept of object repository?

935


How to use debug tools?

2652


what is actually contain test report? can anybody post the test report

1901