In Chethana's code the Entire File content is read and then placed in an variable. But in case of my code... the file is read line by line and then a search is performed..
On Tue, Oct 16, 2012 at 8:59 PM, udhaya kumar <[email protected]>wrote: > Hi Gautham, > > Yes i use chetanas code only. May i know how that improve performance. i > use just because it stores value in variable not an array. > > > Thank You, > Udhay > > > On Tue, Oct 16, 2012 at 5:47 PM, Gautham Maroli > <[email protected]>wrote: > >> 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 >> > > -- > 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
