标题: 对OBJECT对象的鼠标点击操作(脱离坐标) [打印本页] 作者: lantianwei 时间: 2007-8-30 12:45 标题: 对OBJECT对象的鼠标点击操作(脱离坐标) 相信大家可能会碰到过这样的情况:看起来是Button对象,但用WR的SPY看一下却是Object对象,做映射也映射不了(比如说用WR没有插件的情况下不支持的语言开发的按钮),这时我们如果录制操作该按钮的话,就发现有坐标出现。而对于脚本的移植性而言,坐标是绝对要抛弃的。那么我们有什么方法来屏蔽这些坐标呢?下面是我写的两个对这些按钮的左右键单击的操作(该函数只对类似按钮的对象起作用):
#*************************************************************************************************
#
# Description---------This function is used to LEFT Click an Object
#
# Parameter-----------win---WindowName,obj---ObjectName
#
# Return Value-------None
#
# Tester----------------LantainWei
#
#*************************************************************************************************
public function Obj_LClick(in win,in obj)
{
auto obj_width,obj_height;
set_window(win);
obj_get_info(obj,"width",obj_width);
obj_get_info(obj,"height",obj_height);
obj_mouse_click(obj,int(obj_width/2),int(obj_height/2),LEFT);
}
#*************************************************************************************************
#
# Description---------This function is used to Right Click an Object
#
# Parameter-----------win---WindowName,obj---ObjectName
#
# Return Value-------None
#
# Tester----------------LantainWei
#
#*************************************************************************************************
public function Obj_RClick(in win,in obj)
{
auto obj_width,obj_height;
set_window(win);
obj_get_info(obj,"width",obj_width);
obj_get_info(obj,"height",obj_height);
obj_mouse_click(obj,int(obj_width/2),int(obj_height/2),RIGHT);
}