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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / syamala usha

set fso = createobject("scripting.filesystemobject")

set f=fso.opentextfile("C:
otes HP.txt",1)


Do until f.atendofstream

str=f.readline

a = split(str," ")

flag=0

for j = 0 to ubound(a)

if (a(j) = "testing") or (a(j) = "qtp") then

flag=1

exit for

end if

next

if flag=1 then

msgbox str

end if

loop

f.close

set f= nothing

set fso =nothing

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More VB Script Interview Questions

What is dictionary object in vbscript? Explain?

0 Answers  


How to write functional test cases for send button in gmail.

2 Answers   Arctern,


i want to when we will write the scripts either after getting the build or after getting the SRS?

3 Answers  


w r p syed then output was deys and click eysd and click ysde and click sdey and click deys and click eysd............

2 Answers   Cap Gemini, iGate,


I am running a windows based application.While running the script on QTP ,The Application pop-up an Error Message as "object Disabled" in two different scenarios Scenario 1-->The Application pop-up up a Message for Max Session Reached(as the application is set to hold 2 session and if if crosses the pre-defined limit then the error message pop-up) Scenario 2-->When Network connectivity is disabled the Application screen gets greyed out in colour with no operation possible. Now through Exception handling features in QTP ,we need to do the following For Scenarion 1-->Through Exception handling we need to just accept the Message pop-up in the Application and and resume with the call function as is for Scenario 2--> Through Exception Handling featutes on QTP we need to shut down the client , restart the client and resume the call functions as it is Note: The Application returns an Error Message as "object disabled" in both the cases i.e for pop-up message and when the Apllication getting greyed out due to Network failure how can we enhance the script in such a way that for the same error message retured by the application in two different and how to handle them????

2 Answers   Sasken,






did any one attended interview in applabs if you had gone through plz tell me the procedure

0 Answers  


best training centre in bangalore

2 Answers  


Am working with web application. i faced one senario. i.e, webpage having webtable having two coloumns, in that first coloumn is for serial no and second coloumn is for mac address link, now i want to get first row second coloumn value, that having macaddress as link. Please help me how to get that link?

2 Answers  


How will you get the octal value of the given number in vbscript?

0 Answers  


Explain the scope of the variables using dim, public, and private keywords respectively.

0 Answers  


How to Enter Values on the Command promt using VB script

0 Answers  


when you use For Loop, While..do, do..while? at what situations which loop will use.

1 Answers  


Categories