Tuesday 12 June 2012


QTP - Working with text file using VB script

 


QTP - VB script to write the content of a text file

'============================================
Set objFileToWrite = CreateObject("Scipting.FileSystemObject")
objFileToWrite .OpenTextFile("C:\myfiletxt.txt",2,true)
objFileToWrite.WriteLine(data)
objFileToWrite.CloseSet objFileToWrite = Nothing

'============================================


QTP - VB script to read the content of a text file

'============================================
Set objFileToRead = CreateObject("Scripting.FileSystemObject")
objFileToRead.OpenTextFile("C:\myfiletxt",1)
strFileText = objFileToRead.ReadAll()
objFileToRead.Close
Set objFileToRead = Nothing
'============================================= 
 

No comments:

Post a Comment