|
脚本:
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
toolbar_button_press("ToolbarWindow32_0","Stop");
wait(2);
# WorkerW
set_window ("WorkerW", 1);
list_activate_item ("SysListView32", "Flight 4A (2)");
wait(4);
# Login
set_window ("Login", 4);
edit_set ("Agent Name:", "mercury");
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
wait(7);
table="C:\Documents and Settings\Administrator\My Documents\lesson7\Book1.xls";
rc=ddt_open(table,DDT_MODE_READ);
if (rc!=E_OK && rc!=E_FILE_OPEN)
pause("cann,t open table");
ddt_get_row_count(table,table_RowCount);
for(table_Row = 1;table_Row<=table_RowCount;table_Row ++)
{
ddt_set_row(table,table_Row);
# Flight Reservation
set_window ("Flight Reservation", 9);
menu_select_item ("File;Open Order...");
wait(1);
# Open Order
set_window ("Open Order", 1);
button_set ("Order No.", ON);
#pause(ddt_val(table,"A"));
edit_set ("Edit", ddt_val(table,"A"));
button_press ("OK");
wait(1);
# Flight Reservation
set_window ("Flight Reservation", 8);
menu_select_item ("File;Fax Order...");
wait(4);
# Fax Order No. 3
aa="Fax Order No. "&ddt_val(table,"A");
pause(aa);
form=set_window (aa, 8);
if (form!=E_OK && form!=E_FILE_OPEN)
pause("error");
wait(2);
s=edit_get_text("# Tickets:",tickets);
if (s!=E_OK && s!=E_FILE_OPEN)
pause("error");
t=edit_get_text("Ticket Price:",price);
t=edit_get_text("Total:",total);
pause(tickets);
pause(price);
pause(total);
if (tickets*price==total)
tl_step("total",0,"Total is correct");
else
tl_step("total",1,"Total is not incorrect");
wait(1);
button_press ("Cancel");
}
ddt_close(table);
我在default.xls中加了两个数据 3,1
第一次循环读取3,运行正常
第二次循环读取1,运行到form=set_window (aa, 8);这句话后,pause("error");就会打印出error,这是为什么呢?如何修改呢?请指教 |
|