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 to use import and export sheet methods in qtp

1 Answers  


Hi All, I am new to QTP but i was trained on winrunner before. My problem is..QTP 8.2 was unable to record my application which is a java app. By selecting smart identification, i was somehow able to record the test BUT QTP cant run the test! Can anyone help me in walking through this problem..Is java addin really necessary for this?? Is there anyways i can run the test successfully? I am not sure whats going wrong in my testing.Please do help me asap as i need to submit the report early. Thanks in advance

4 Answers  


Explain abt the File System Object in QTP with ex

3 Answers   Ordain Solutions,


What is the function of Filter in QC . give with a real time example.

1 Answers   TCS,


Can any give an example(if possible templates) how to test web application using QTP. thanks in advance

0 Answers  






Can anybody send me the code to get the RO property of the active screen in QTP while running?

9 Answers  


i am giving.multiple names like ram,raj,san etc....pls enter & search these names in google pade edit box through script... i told to interviewer, using Ms excel & test easily..but interviwer not happy with that answer?

2 Answers   Accenture,


what are build and version plz explain why nomber changes in build and version?

3 Answers  


i m tryed to use qtp in a user registration form but at the "image enter"part it gives a error when i run the qtp bcz the image is changed every time so it gives a error when i use regukar expreesion fot this it still gives a error value bcoz it reads the image code bt nt reconige the image which i enter in the image verification text box.so hw can i automate qtp for this function.plz give me a answer

1 Answers  


i have string "I LIKE INDIA"..how to i get LIKE from the sting..

6 Answers   HealthAsyst,


i am trying to capture the URL from the open browser and store it. pls give me solution how we can do this in QTP. thanks

2 Answers  


Can we test the Word Document using QTP Tool? We should test the page size,page set up, paragraph indentation and spacing, font size of the the character int the page.

1 Answers  


Categories