Hi uday... Both the codes do work.... But if you want better performance...you shoul use chetanas code On Oct 16, 2012 4:59 PM, "udhaya kumar" <[email protected]> wrote:
> Hi, > > Both the codes are working fine.Thanks Gautham and Chethana. > > > Regards, > Udhay > > On Mon, Oct 15, 2012 at 4:15 PM, Gautham <[email protected]> wrote: > >> >> hi, >> >> Please find the script below: >> >> Option Explicit >> Dim Fso, oFile,gFile, strLine, strLine_1,arr_FailedLines ' Variable >> Declarations >> Const FileName = "C:\SampleTestCase.txt" ' Constant File Name along >> with path >> Set Fso = CreateObject("Scripting.FileSystemObject") ' Create an >> instance of a FileSystem >> Set gFile = Fso.GetFile(FileName) ' Get the file name >> Set oFile = Fso.OpenTextFile(FileName) ' Open the File >> Do Until oFile.AtEndOfStream ' A loop that will read file line by line >> and place the line in a strting by usinfg '|' as a seperator between two >> line >> strLine = oFile.ReadLine >> If Instr(strLine,"Fail") >0 Then >> strLine_1 = strLine_1 &"|"&strLine >> End If >> Loop >> arr_FailedLines = Split(strLine_1,"|",-1,1) ' Split the lines and place >> the contents in an array. The failed lines can be accessed in this array >> from element 1 (i.e. arr_FailedLine(1)) >> Set oFile = Nothing >> Set gFile = Nothing >> Set Fso = Nothing >> >> >> >> >> Thanks, >> Gautham Maroli >> >> >> On Monday, October 15, 2012 3:36:49 PM UTC+5:30, udhaya kumar wrote: >> >>> Hi All, >>> >>> >>> i have attached text file which has pass and fail lines. I >>> want to read each fail lines and i want to store it in single variable. >>> >>> >>> >>> Please Help me in this, >>> >>> >>> Thanks, >>> Udhay >>> >> -- >> You received this message because you are subscribed to the Google >> "QTP - HP Quick Test Professional - Automated Software Testing" >> group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/MercuryQTP?hl=en >> > > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en > -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en
