How to use Text file (Notepad) as ur data source in QTP?
Can u please provide some function code for it?

Answer Posted / gp

For this you need create File system object.
Below code is for reading from text file


Const ForRead=1

Dim objFSO, objFile, strText
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Reading code
Set objFile=objFSO.OpenTextFile("z:\filetext.txt", ForRead)
Do until objFile.AtEndOfStream

strText=objFile.ReadLine
msgbox strText
Loop

objFile.close

Set objFile = nothing
Set objFile1 = nothing
Set objFSO =nothing

"strText" variable will now contain data from text file.

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of regexp object in vbscript?

547


A folder is there inside no of textfiles are avilable. How do count the textfiles. Normally folder means we are using subfolder methods but textfiles is not working for subfolder methods and how do get file name also.

1500


I want to run QTP script on Linux server is it possible to do this by connecting Windows to Linux through VPN/Terminal Server and just run the script on Linux server.

1778


does anyone have qtp11.0 license key.Please sendit to my mail id-rrvv2011@gmail.com...Thanks

2496


what is resorceallocation

1766






Mention what is the technology used by vb script?

514


How many types of procedures are available in the vbscript language?

521


How should i Create Email invite with server-side Coding?

1594


Explain few date functions in vbscript?

609


How can you create a file object to work with the files in the vbscript language?

496


hi Set myobj=Description.Create() myobj("type").value="submit" myobj("name").value="google search" myobj("html tag").value="button" browser("title:=google").page("title:=google").webButton (myobj).Click i was running above code in one weak back it was working fine i got result,again i opened after few days ,again i was trying to run the code it shows run time error in last line of my code ,why ?pls answer my question?

1725


What are the 2 ways in which a variable can be declared in the vbscript language?

556


Illustrate briefly about the different types of statement

2014


What's the difference between vbscript and vb.net?

544


Hi Friends my Question is very simple,in Manual testing when we click on a hyper link it directs us to the relavent page or it re-directs us to the current page,so there we can easily write testcase but same thing if we do in automation script using QTP & need to generate report using Reporter.report event how we will do it?thanks in advance...

1645