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

Hello friends..... Can any give the methods for Ms-Access, and Mozilla firefox in Automation Object Model in QTP. Please give me currect answers... if you do not understand my question please don't give answers. Thanking you.

2092


Which operator can be used to do an xor operation in vbscript?

963


Explain the .wsf files?

717


How to access array data?

747


How strcomp function works?

843


How can the spaces from the string be removed?

789


What are the data types supported by vbscript?

796


Which date function is used in the vbscript language to find the difference between the 2 dates?

805


How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...

3143


who will create the object?

1908


If we take 2 strings as “good” and “bad” then what will ‘+’ and ‘&’ operators return?

740


When does ‘on click of button’ event gets triggered in the vbscript language?

764


Hai this is sheik, i want to learn VB scripts for web application pls guide me what are all basic things need to know to learn VB scripts in web application.

1641


Write a Program to add 2 numbers without using operators (+,-) and without using third variable. Note: Use VBScript only Hint: You can use other operators like '/' & '*'(Division & Multiplication)

3409


What are the different types of loops available in the vbscript language?

731