|
tickets是int,但price的值是“$123”,就是因为钱前面的单位造成的,你应该首先将字符串前面的金钱单位去掉之后再作比较就好了,使用函数substr(),修改如下:
# Fax Order No. 3
set_window ("Fax Order No. 3", 2);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 0);
button_set ("Order No.", ON);
edit_set ("Edit_1", "3");
button_press ("OK");
# Fax Order No. 3
set_window ("Fax Order No. 3", 3);
menu_select_item ("File;Fax Order...");
# Fax Order No. 3_1
set_window("Fax Order No. 3_1", 1);
static_get_text("# Tickets:(static)",tickets);
static_get_text("Ticket Price:(static)",price);
static_get_text("Total:(static)",total);
#add
price=substr(price,2);
total=substr(total,2);
#add end
if(tickets*price == total)
tl_step("total",0,"total is correct.");
else
tl_step("total",1,"total is incorrect.");
set_window ("Fax Order No. 3_1", 2);
button_press ("Cancel"); |
|