Write a script to insert an Order in flight Reservation Application importing values from an external excel sheet and also display the result as pass

'Script to insert an order and print the Order Number

'Create an object to interact with Excel Library

Set xlapp = CreateObject("Excel.Application")

'Open the excel workbook

Set wbook = xlapp.workbooks.Open("E:\InsertOrder.xls")

'Set the pointer to the worksheet

Set wsheet = xlapp.worksheets(1)

'Get rowcount

rowcount = wsheet.usedrange.rows.count

For i = 1 to rowcount-1

Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type wsheet.cells(i+1,1).Value
Window("Flight Reservation").WinComboBox("Fly From:").Select wsheet.cells(i+1,2).Value
Window("Flight Reservation").WinComboBox("Fly To:").Select wsheet.cells(i+1,3).Value
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set wsheet.cells(i+1,4).Value
Window("Flight Reservation").WinButton("Insert Order").Click
Wait 8
Orderno = Window("Flight Reservation").WinEdit("Order No:").GetRoProperty("text")
wsheet.cells(i+1,5).value = Orderno

If Window("Flight Reservation").Exist(8) Then
wsheet.cells(i+1,6).Value = "Pass"
wsheet.cells(i+1,6).Font.Colorindex = 10
Else
wsheet.cells(i+1,6).Value = "Fail"
wsheet.cells(i+1,6).font.colorindex = 3
End If

Next

wbook.save
wbook.close
xlapp.quit

Set wsheet = nothing
Set wbook = nothing
Set xlapp = nothing

4 comments:

Unknown said...

nice posts..
Hadoop online training .All the basic and get the full knowledge of hadoop.
Hadoop online training


Unknown said...

thank you for providing useful content. it is very useful for students and followers.microstrategy online training

Unknown said...

thank you for providing useful content. it is very useful for students and followers.online microstrategy training

svrtechnologies said...

This post is really nice and informative. The explanation given is really comprehensive and useful... microstrategy training

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */