Friday 9 March 2012

Test to choose cheapest flight for inset order

the below program will work to chose cheapest flight
Add the objects to the test before  executing this code

Window("Flight Reservation").Activate
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Frankfurt"
Window("Flight Reservation").WinButton("FLIGHT").Click

FlightCount = Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItemsCount()
FlightDetails = Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItem(0)
'msgbox FlightDetails

flights = split(FlightDetails,"$")
TempPrice = flights(1)
flight=0
For i=0 to FlightCount-1
FlightDetails = Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItem(i)
'msgbox FlightDetails
flights = split(FlightDetails,"$")
price = flights(1)

If Price<=Tempprice Then
flight = i

End If
'msgbox flight
Next
FlightDetails = Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select(flight)
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
msgbox FlightCount&" "&FlightDetails
Window("Flight Reservation").WinEdit("Name:").Set "test"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").Activate
Window("Flight Reservation").Restore
Window("Flight Reservation").WinObject("Insert Done").Check CheckPoint("Insert Done")








No comments:

Post a Comment