How can i open a file in Textpad and replace a string with
another using QTP



How can i open a file in Textpad and replace a string with another using QTP..

Answer / madhavi

FileLocation="C:\Documents and Settings\\Desktop\file1.txt"

Set fso=CreateObject("Scripting.FileSystemObject")
Set fl=fso.OpenTextFile(FileLocation)
txtToReplace=replace(fl.ReadAll,"QTP","QTP9.5")
fl.Close

Set fl=fso.OpenTextFile(FileLocation,2)
fl.Write(txtToReplace)
fl.Close

Is This Answer Correct ?    5 Yes 4 No

Post New Answer

More QTP Interview Questions

how can we handle exceptional handling in qtp

6 Answers   NIIT,


Can any one tell the different properties and values of differnt objects like Browser,Page,link,webedit,webcombobox,webradio botton,webcheckbox and web button.Because I am facing a lot of problems in interviews with Descriptive Programing.I never worked on web Application...Pls help any one as soon as possible....

2 Answers  


Hi Friends, I'm new to QTP. I want to write a function in QTP for below senario. In an Excel sheet column B, I Have 10 Url/Links, and in Colum A there is a Flag as Y and N. My test should run only on those iterations which are flagged as Y. Please help, Thanks

6 Answers  


Problem with XML checkpoint in QTP ?

0 Answers  


Hi can anyone pls suggest how to fetch username(system login name)and system name in to qtp.I am not using TD or QC.Thx

5 Answers  






how to tell about testing a website in interview using qtp?? what r the points to be covered mainly?

2 Answers  


How does qtp recognize objects in aut?

0 Answers  


what sort of things what u put in Bug Report ?

1 Answers  


I want to configure the OR and library files to a particular QTP test during run time. Note: OR and Library files are located in Quality Center. Is it possible in QTP? Anybody having code?

0 Answers  


In project module it contains 3-ok buttons with same properties who qtp identify its objects while runing ??

5 Answers   HCL,


How to set the function parameters as optional. Pls anybody can give the answer.. Thanks in advance...

2 Answers   Navis,


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

0 Answers   TCS,


Categories