Write a program to print all lines that contains a word either “testing” or “qtp”

Answer Posted / amit

''' Write a program to print all lines that contains a word either “testing” or “qtp”




Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")




Set objFile = fso.OpenTextFile("C:UsersAmit MoolchandaniDesktop est.txt",1,True)












Do While objFile.AtEndOfStream <> True
str = objFile.ReadLine
If Instr(1,str,"Testing",1) Or Instr(1,str,"qtp",1) Then
Print str
End If




Loop




objFile.Close




Set objFile = Nothing
Set fso = Nothing

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hellow friends, I am learning QTP,but here problem is VB script. please guide me how to learn VB script w.r.t QTP and if you know any books tell me or if you have any materials or any use full material or any else w.r.t QTP please post me p.p.sekhar

2086


Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?

3118


What is the use of the instr function?

672


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

2599


Which event is triggered when mouse focus comes out of an element in the vbscript language?

593






How are comments handled in the vbscript language?

613


Why is error handling required?

651


What are the rules to name variable in vbscript?

670


What is the main difference between function and sub-procedure?

635


What is event handling in vbscript?

686


Mention how to access array data?

595


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)

3269


Which constant is used for print and display functions and works as same as pressing enter key?

627


Which function is used in the vbscript language to convert the specified expression into a date type value?

610


How to create a cookie using vbscript?

683