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

What is difference between vbscript and vba?

604


What is purpose of scripting.filesystemobject class in vbscript?

618


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

527


What are subprocedures in vbscript?

653


How will you get the smallest subscript of an array in vbscript?

801






Explain the filter expression?

623


What are the data types supported by vbscript?

574


What is the difference between VBScript and JavaScript?

2051


Hello Friends , I am the new joinner of this website. I am working with Sapient ,Gurgoan I would like to ask few qurries regarding the QTP Tool of (Testing) Currently working on QTP Tool . I would like to no learn VB Script can u name some Books which i get in market. And a small issue in QTP I had 2 users right i have to login and send the document from this user to second user right. when i am send this doc some contendId number generates right. now i am loging into second user and i have to search for that contentId right i found it now i dont want to accept the document so i had an opption of check out ok i have to click on check out my QTP Code is like this Browser(" ").Page(" ").WebTable(" ").ChildItem (3,5,"Image",0).click Browser(" ").Page(" ").Link("ChecK Out").Click i new this code is perfectly right but when i am run the script i have to click on that particular contentId and click on check out but now the Problem is started the error is the document has been already checked out remeber every time my content id changes means it is the new contentId which is not been used atleast once Please help me out in this issue i am in big trouble

2021


Explain different types of segment?

563


How to open browser in vb script?

579


In what way program "hello world" you can write in vbscript?

638


When are redim statement and preserve keyword used in the vbscript language?

587


Explain about the functionality of vb script?

565


What are the advantages of vbscript?

640