|
参考下这个吧,是对flight4a.exe的操作:
Function GetList(i)
Randomize
GetList=RandomNumber(0,i) '随机取0到i之间的数
End Function
Dim get_count,ram,result ,get_count1,ram1,result1
Dialog("Login").WinEdit("Agent Name:").Set "ssss"
Dialog("Login").WinEdit("Password:").SetSecure "47cba4ffdb1b3a2d760d3077d4e2d32062570456"
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").WinObject("Date of Flight:").Type("030608")
get_count = window("Flight Reservation").Wincombobox("Fly From:").GetItemsCount '获取列表中的item总数
ram = GetList(get_count-1) '随机生成一个值
result=window("Flight Reservation").WinComboBox("Fly From:").GetItem(ram) '根据随机生成的值取得相应的下拉框值
window("Flight Reservation").WinComboBox("Fly From:").Select result '值返回到下拉框中
'msgbox(result)
get_count1 = window("Flight Reservation").WinComboBox("Fly To:").GetItemsCount
ram1 = getlist(get_count1-1)
result1 = window("Flight Reservation").WinComboBox("Fly To:").GetItem(ram1)
window("Flight Reservation").WinComboBox("Fly To:").Select result1
window("Flight Reservation").WinButton("FLIGHT").Click
Dim get_count2,ram2,result2
get_count2 = dialog("text:=Flights Table","window id:=0").winlist("attached text:=From","window id:=2001").GetItemsCount
ram2 = getlist(get_count2-1)
result2 = dialog("text:=Flights Table","window id:=0").winlist("attached text:=From","window id:=2001").GetItem(ram2)
dialog("text:=Flights Table","window id:=0").winlist("attached text:=From","window id:=2001").Select result2
dialog("text:=Flights Table","window id:=0").winbutton("text:=OK").Click
window("Flight Reservation").WinEdit("Name:").Set "sslin"
window("Flight Reservation").WinEdit("attached text:=Tickets:","window id:=1029").Set "2"
window("Flight Reservation").WinRadioButton("Business").Set
window("Flight Reservation").WinButton("Insert Order").Click |
|